宏未按目标C

时间:2015-09-10 07:21:02

标签: ios objective-c macros

我有一个宏,非常简单,但我不明白问题出在哪里?我收到了错误:

"Expected ; after expression"

这是一个宏定义:

#define SEGCONTROL (itemArray, segmentedControl)      \
segmentedControl = [[SuperSegmentedControll alloc] initWithItems:itemArray];                                        \
segmentedControl.frame = CGRectMake(0, 0, 60, 28);     \
segmentedControl.layer.cornerRadius = 05;              \
[segmentedControl setTintColor:[UIColor colorWithRed:0.0/255.0 green:0.0/255.0 blue:102.0/255.0 alpha:1]];                  \
segmentedControl.backgroundColor = [UIColor colorWithRed:19.0/255.0 green:62.0/255.0 blue:137.0/255.0 alpha:1];              [segmentedControl setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor]} forState:UIControlStateNormal];                                \
[segmentedControl setTitleTextAttributes:               @{NSForegroundColorAttributeName:[UIColor whiteColor]} forState:UIControlStateSelected]; \

我打电话如下:

 NSArray *itemArray = [NSArray arrayWithObjects: @"Save", nil];
 SuperSegmentedControll *segmentedControl;
 SEGCONTROL(itemArray, segmentedControl);

我想将宏创建为在许多地方使用的类似代码。要保存,请取消ETC.

0 个答案:

没有答案