码迷,mamicode.com
首页 > 其他好文 > 详细

UICollectionView registerClass

时间:2021-01-08 11:45:41      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:red   highlight   ring   init   instant   str   LLC   button   pre   

UICollectionView的方法registerClass,如果调用会使注册的cell类在xib或storyboard里的相关内容失效。比如你在storyboard里为这个cell类加了一个button,那么实际上不会显示。

// If a class is registered, it will be instantiated via alloc/initWithFrame:
- (void)registerClass:(nullable Class)cellClass forCellWithReuseIdentifier:(NSString *)identifier;

 看这个方法的注释,如果注册一个重用cell类,那么这个cell会通过initWithFrame初始化,意味着不再通过xib或storyboard初始化。

UICollectionView registerClass

标签:red   highlight   ring   init   instant   str   LLC   button   pre   

原文地址:https://www.cnblogs.com/liuyongfa/p/14245994.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!