iOS 运行时判断xib是否存在

时间:2015-07-09 19:34:00   收藏:0   阅读:1769

知识要点  

1.  xib最终会变成nib文件

2.  NSBundle实例方法  - (NSString *)pathForResource:(NSString *)name ofType:(NSString *)ext;

     如果bundle中不存在某个文件,则返回的path为nil,如果存在 则会返回该文件的路径

 

因此运行时判断xib是否存在某个xib文件(eg:TestXibController.xib)方法:

    NSString *nibPath = [[NSBundle mainBundle] pathForResource:@"TestXibController" ofType:@"nib"];

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!