IOS xib,文件加载笔记

来源:互联网 发布:接口测试软件 编辑:程序博客网 时间:2024/04/28 22:40
xib加载两种方式: 

1> [[NSBundle mainBundle] loadNibNamed:<#(NSString *)#> owner:<#(id)#> options:<#(NSDictionary *)#>]

 Name 参数是文件名(注:不用写后缀),owner参数在不需要事件处理填写nil ,options 参数填写nil;

2> [UINib nibWithNibName:<#(NSString *)#> bundle:<#(NSBundle *)#>];

 Name 参数是文件名(注:不用写后缀),bundel 参数默认是mainBundle   直接填nil = mainBundle; 

以上返回都是nsarray类型,

加载plist文件:

[NSArrayarrayWithContentsOfFile:[[NSBundlemainBundle]pathForResource:文件名 ofType:文件后缀]]

[NSArrayarrayWithContentsOfFile:[[NSBundlemainBundle]pathForResource:文件名.后缀 ofType:nil]]



0 0
原创粉丝点击