1. 宏中的 ## 的含义
#define KTVHCLogEnable(target, console_log_enable) \
static BOOL const KTVHCLog_##target##_ConsoleLogEnable = console_log_enable; \#define Name(target) weibo_##target##_name
#define View(target) view##target##Label
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
NSString * Name(lefex) = @"Lefe_x";
// 打印:You weibo name is: Lefe_x
NSLog(@"You weibo name is: %@", weibo_lefex_name);
UILabel *View(1) = [UILabel new];
view1Label.backgroundColor = [UIColor redColor];
UIView *View(2) = [UIView new];
view2Label.backgroundColor = [UIColor yellowColor];
}Last updated
Was this helpful?