摘要:
// // main.m // Copy基本使用,拷贝的本质:修改其中一个不能影响另外一个。 // 每个oc对象都有copy和mutableCopy方法,前提是必须遵守NSCopying协议实现copyWithZone方法和NSMutableCopying协议实现mutableCopyWithZone方法。 // copy出来的对象是不可变的(NSString,NSArray,NSD... 阅读全文
posted @ 2017-08-27 22:41
无天666
阅读(270)
评论(0)
推荐(0)
摘要:
// // main.m // 集合(数组)对象的内存管理(MRC中) // #import #import "Person.h" int main(int argc, const char * argv[]) { @autoreleasepool { // 1. 如果将一个对象添加到一个数组中, 那么数组会对对象进行一个retain ... 阅读全文
posted @ 2017-08-27 22:31
无天666
阅读(257)
评论(0)
推荐(0)
摘要:
// main.m // NSFileManager #import int main(int argc, const char * argv[]) { NSFileManager *manager = [NSFileManager defaultManager]; // 1.判断一个文件或者文件夹是否存在 BOOL flag = [manager f... 阅读全文
posted @ 2017-08-27 22:02
无天666
阅读(265)
评论(0)
推荐(0)
摘要:
// // main.m // OC中的常用结构体 // #import int main(int argc, const char * argv[]) { // 1.保存坐标的 // NSPoint === CGPoint;别名 CGPoint point = NSMakePoint(10, 20); // 2.保存尺寸的 // ... 阅读全文
posted @ 2017-08-27 21:51
无天666
阅读(276)
评论(0)
推荐(0)
摘要:
// // main.m // NSMutableDictionary // NSDictionary不可变,初始化后就不可以修改,NSMutableDictionary可变,初始化后可以改变。 // #import int main(int argc, const char * argv[]) { // 1.创建一个空的字典 NSMutableDictionary... 阅读全文
posted @ 2017-08-27 18:13
无天666
阅读(233)
评论(0)
推荐(0)
摘要:
// // main.m // NSDictionary // // #import int main(int argc, const char * argv[]) { // 1.如何创建 NSDictionary *dict1 = [NSDictionary dictionaryWithObject:@"lnj" forKey:@"name"]; NSStr... 阅读全文
posted @ 2017-08-27 18:02
无天666
阅读(243)
评论(0)
推荐(0)
摘要:
// // main.m // NSMutableArray ,可变数组 #import int main(int argc, const char * argv[]) { // 创建一个空的数组 NSMutableArray *arrM = [NSMutableArray array]; NSLog(@"%@", arrM); // 如何添... 阅读全文
posted @ 2017-08-27 16:51
无天666
阅读(394)
评论(0)
推荐(0)
摘要:
// // main.m // NSArray和NSString之间转换 #import int main(int argc, const char * argv[]) { NSArray *arr = @[@"lnj", @"lmj", @"jjj"]; // 需求: 用-将所有的姓名连接起来生成一个字符串 // 1.定义一个可变字符串保存拼接之后... 阅读全文
posted @ 2017-08-27 16:24
无天666
阅读(186)
评论(0)
推荐(0)
摘要:
// Person.h #import @interface Person : NSObject @property (nonatomic, assign) int age; @end // Person.m #import "Person.h" @implementation Person - (NSString *)description { return [N... 阅读全文
posted @ 2017-08-27 16:09
无天666
阅读(284)
评论(0)
推荐(0)
摘要:
// // Person.h #import @interface Person : NSObject - (void)say; - (void)sayWithName:(NSString *)name; @end // // Person.m #import "Person.h" @implementation Person -(void)say { NSLog... 阅读全文
posted @ 2017-08-27 15:40
无天666
阅读(252)
评论(0)
推荐(0)

浙公网安备 33010602011771号