zoukankan      html  css  js  c++  java
  • iOS开发之都兴忱小结

    1、NSArray/NSDictionary

    ------>

    strong temp和self.arr是同一地址。

    2、NSArray/NSDictionary

    ------->copy temp和self.arr也是同一地址。

    3、NSMutableArray/NSMutableDictionary

    -------->strong temp和self.arr是同一地址。

    4、NSMutableArray/NSMutableDictionary

    -------->copy temp和self.arr不是同一地址。

    5、block用strong和copy都是一样的。

    6、NSMutableArray/NSMutableDictionary

    ------> copy时所有独属mutable方法都不能用,用就会崩溃,比如NSMutableArray的addObject。为什么copy之后那个地址就是不变的,不变的怎么能用变的方法。

    7、weak和assign区别:

    a、assigin 可以用非OC对象,而weak必须用于OC对象
    b、在ARC中,在有可能出现循环引用的时候,往往要通过让其中一端使用weak来解决,比如:delegate代理属性
    c、自定义IBOutlet控件属性一般也使用weak。

  • 相关阅读:
    17. Letter Combinations of a Phone Number
    16. 3Sum Closest
    15. 3Sum
    14. Longest Common Prefix
    13. Roman to Integer
    12. Integer to Roman
    11. Container With Most Water
    10. Regular Expression Matching
    9. Palindrome Number
    8. String to Integer (atoi)
  • 原文地址:https://www.cnblogs.com/LiLihongqiang/p/5647721.html
Copyright © 2011-2022 走看看