zoukankan      html  css  js  c++  java
  • -[UITableView copyWithZone:]: unrecognized selector sent to instance 0x7XXXXXX00

    -[UITableView copyWithZone:]: unrecognized selector sent to instance 0x7XXXXXX00

    -[Class copyWithZone:]: unrecognized selector sent to instance 0x7XXXXXX00

    出现这个错误的原因是,全局的属性的修饰词写错了,

    比如一个view 本来应该用weak和strong 修饰,结果你写成了copy  那么就会出现这个错误

    错误:

    @property (nonatomic,copy) UITableView *tableView;     //tableView;

    正确:

    @property (nonatomic,strong) UITableView *tableView;     //tableView;

    下面来自外国兄台的回答给大家个参考

    Your -setObj1: method is declared as copy, so it calls -copy on your Class1 object. -copy just calls -copyWithZone:nil. So you either need to implement the NSCopying protocol (which means implementing -copyWithZone:), or change your property from copy to retain.

    To make your class respond to copyWithZone:, you have to implement the NSCopying protocol in your class. And you must override the copyWithZone: method.

    要实现自定义对象copy,需遵守NSCopying、NSMutableCopying协议,实现copyWithZone、mutableCopyWithZone 方法

    更多关于copy请看

    https://blog.csdn.net/qq_25639809/article/details/80048843

     
  • 相关阅读:
    静态代码块执行时机
    java中的命令
    JDBC
    final, finally, finalize
    面向对象
    线程中常用的一些方法
    线程中的yield()
    线程中的join()
    Thread对象 既传入了Runnable对象又重写了run()方法
    Python 绘制词云
  • 原文地址:https://www.cnblogs.com/isItOk/p/10803683.html
Copyright © 2011-2022 走看看