NSBundle的使用

使用主束来获取需要的资源文件:

<wbr></wbr>

NSBundle<wbr>*bundle = [</wbr>NSBundle<wbr></wbr>mainBundle];

NSString<wbr>*plistPath = [bundle<wbr></wbr></wbr>pathForResource:@"statedictionary"<wbr></wbr>ofType:@"plist"];

或者简写成一行:

<wbr></wbr>

NSString<wbr>*path = [[</wbr>NSBundle<wbr></wbr>mainBundle]<wbr></wbr>pathForResource:@"sortednames"<wbr></wbr>ofType:@"plist"];

NSDictionary<wbr>*dict = [[</wbr>NSDictionary<wbr></wbr>alloc]<wbr></wbr>initWithContentsOfFile:path];

你可能感兴趣的:(Bundle)