直接将xib放到bundle里面,运行的时候会报错:
Terminating app due to uncaught exception
‘NSInternalInconsistencyException’, reason: ‘Could not load NIB in bundle:
‘NSBundle /Documents/asset-4.bundle> (not yet loaded)’ with name ‘file”
所以需要将xib转成nib再放进去。
执行命令:
$ ibtool --errors --warnings --output-format human-readable-text --compile file.nib file.xib
使用xib的方法:
NSBundle *bundle = [NSBundle bundleWithPath:[[NSBundle mainBundle] pathForResource:@"xxx" ofType:@"bundle"]];