首页 > 其他 > 详细

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

时间:2015-12-30 00:22:39      阅读:164      评论:0      收藏:0      [点我收藏+]

      报错代码如下:‘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解决办法

原文:http://www.cnblogs.com/xqry/p/5087415.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!