当我使用xib布局作为UITableViewCell,绑定xib中的UIImageView时,一直报这个错学习ios碰到[UITableViewCellContentView setImage:]: unrecognized selector sent to instance 0x7fa450440dc0

我的代码是这样的:

学习ios碰到[UITableViewCellContentView setImage:]: unrecognized selector sent to instance 0x7fa450440dc0

后来在xib中改了一下UIImageView的tag的值,将其改为3

学习ios碰到[UITableViewCellContentView setImage:]: unrecognized selector sent to instance 0x7fa450440dc0

再修改绑定的tag为3

学习ios碰到[UITableViewCellContentView setImage:]: unrecognized selector sent to instance 0x7fa450440dc0

奇迹般的好了,后来百度了一下才发现,原来tag=0为保留值,所以不能使用tag=0,有时候可能012都是保留值,如UIsScollView,tag查找控件的方式是通过遍历控件去查找的。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-11
  • 2021-06-12
  • 2021-06-09
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-04-21
  • 2022-12-23
  • 2021-10-26
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案