objective-c数组的四种遍历方法总结
objective-c 语言 数组遍历的4种方式:1、普通for循环;2、快速for循环;3、特性block方法;4、枚举方法。
Blog类:
01 |
#import
"Blog.h" |
02 |
@implementation
Blog |
03 |
04 |
+(Blog
*)blog{ |
05 |
Blog
* blog = [[Blog alloc] init]; |
06 |
return blog; |
07 |
} |
08 |
09 |
-(Blog
*)setBlogTitle:(NSString *)title andContent:(NSString *)content{ |
10 |
_title
= title; |
11 |
_content
= content; |
12 |
return self; |
13 |
} |
14 |
15 |
-(NSString
*)description{ |
16 |
return [NSString
stringWithFormat:@ "blog
: title is "%@" , and content is "%@"" ,
_title,_content ]; |
1
|