今天主要学习了三个知识点:
1.两个类的相互调用,在.h文件中都使用@class加类名,用分号结束。
在 .m文件中要调用,就须要在 .m文件的开始用#import加类名进行声明学习
2.字符串用for循环的输出:
NSMutableArray *a=[NSMutableArray arrayWithObjects:"aaaa","bbbb",nil ];
for (int i=0; i<[a count]; i++) {
NSLog("%@
",[a objectAtIndex:i]);
//上一行也可写为:NSLog("%@
",a[i]);
}spa
3.字典用for循环输出:
NSDictionary *dict={"a":"1","b":"2"};
NSMutableDictionary *dict1=[NSMutableDictionary dictionaryWithDictionary: dict];
for (id key in dict1) {
id value=[dict1 objectForKey:key];
NSLog("key:%@------value: %@",key,value);
}code