Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
修改 Demo_13
原先的例子中,NSArray 无论声明为 strong 还是 copy,输出都是一样的,不能证明 copy 起到的复制作用。
  • Loading branch information
yuchenzhan committed Mar 30, 2017
commit f759434b373187d870cf1dbfed80d69cb4ab3365
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ @implementation ViewController

- (void)viewDidLoad {
[super viewDidLoad];
NSMutableArray *mutableArray = [[NSMutableArray alloc] init];
NSArray *array = @[ @1, @2, @3, @4 ];
NSMutableArray *mutableArray = [NSMutableArray arrayWithArray:array];

self.array = mutableArray;
[mutableArray removeAllObjects];;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1226,8 +1226,9 @@ void objc_setProperty(id self, SEL _cmd, ptrdiff_t offset, id newValue, BOOL ato
然后进行下面的操作:

```Objective-C
NSMutableArray *mutableArray = [[NSMutableArray alloc] init];
NSArray *array = @[ @1, @2, @3, @4 ];
NSMutableArray *mutableArray = [NSMutableArray arrayWithArray:array];

self.array = mutableArray;
[mutableArray removeAllObjects];;
NSLog(@"%@",self.array);
Expand Down