美文网首页
iOS copy、strong 修饰词 和 copy、mutab

iOS copy、strong 修饰词 和 copy、mutab

作者: Empty_One | 来源:发表于2018-09-18 15:37 被阅读21次
    1. copy 修饰mutableArray时会开辟一个新的地址。strong 修饰mutableArray不会开辟新的地址


      图片1.jpg
    2. copy 修饰mutableArray类型为NSArray类型,strong 修饰mutableArray是NSMutableArray类型 图片2.jpg
    3. 数组中元素的值与赋值元素地址相同,改变一个数组中元素的值,其他同一元素中的值也相应改变 图片3.jpg
    4. 实现NSCopying 和 NSMutableCopying协议后,调用 [[NSMutableArray alloc]initWithArray:<#array#> copyItems:<#bool#>];方法会copy数组中的元素。 图片4
    5. copy 和 mutableCopy 这个帖子写的很详细:
      https://www.jianshu.com/p/700f58eb0b86

    相关文章

      网友评论

          本文标题:iOS copy、strong 修饰词 和 copy、mutab

          本文链接:https://www.haomeiwen.com/subject/nhcpnftx.html