星空网 > 软件开发 > 操作系统

跳转UICollectionViewController报Could not load NIB in bundle解决办法

      报错代码如下:'Could not load NIB in bundle: 'NSBundle </Users/mac/Library/Developer/CoreSimulator/Devices/A0182119-C6AC-4732-BF37-3E6D35B102E1/data/Containers/Bundle/Application/E5F586ED-526F-4D52-9C7C-9335E772F666/00-ItcastLottery.app> (loaded)' with name 'product''

      项目中collectionViewController的自定义cell由xib创建。无奈每次运行都报这个错,大意是加载不了名字叫“product”的xib文件。网上搜到的办法试过都不行。直到第二晚排查才发现原因太简单,但很容易忽略,如果你不知道,以后可能会在这里摔跟头。

      static NSString * const reuseIdentifier = @"product"; 这行是在UICollectionViewController.m文件用来设定identifier的代码。问题就在“product”字符串这。想不出错,identifier字符串必须和UICollectionViewController控制器加载的自定义cell文件的文件名一样。

      MJ课程视频里并没讲这点注意事项,自学的童鞋按照以上办法解决。




原标题:跳转UICollectionViewController报Could not load NIB in bundle解决办法

关键词:ie

ie
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流