反正有做吗?
我已经尝试过pathForResource:ofType:
NSBundle,但它确实存在时找不到xib。如果我尝试加载它,但它不存在loadNibNamed:owner:options:
崩溃,那么也会崩溃nibWithNibName:bundle:
基本上,我想在运行时知道是否应该在集合视图中为给定的单元格类型注册xib或仅注册一个类。
您确定pathForResource:ofType:
不起作用吗?这不仅是常见的xib / nib混淆吗?
(.xib文件是ofType:@"nib"
)...
NSBundle *mainBundle = [NSBundle mainBundle];
NSString *path = [mainBundle pathForResource:@"crapXib" ofType:@"nib"]; // file is called crapXib.xib
if (path){
// whatever...
} else{
// whatever else
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句