iOS中宏定义太长的话用反斜杠( \ )转义,则可写成多行;
<pre>
define Animation1Arr(arr) {NSBundle *bundle1 = [NSBundle bundleForClass:[SVProgressHUD class]];\
NSURL *url = [bundle1 URLForResource:@"SVProgressHUD" withExtension:@"bundle"];
NSBundle *bundle = [NSBundle bundleWithURL:url];
for (int i=0 ;i<8;i++) {
UIImage *img=[UIImage imageNamed:[NSString stringWithFormat:@"pull_end_image_frame_%02d",i] inBundle:bundle compatibleWithTraitCollection:nil];
[arr addObject:img];
}
}
</pre>
- 注意:写成多行时反斜杠( \ )后面不能有空格,否则编译器会报错!
网友评论