如何使用 .plist 文件填充表视图?
嘿伙计们, 我在选项卡栏应用程序中创建了带有导航控制器的表视图。这是我用来用数据填充表视图的代码:
- (void)viewDidLoad {
[super viewDidLoad];
self.title = NSLocalizedString(@"Glossary", @"Back");
NSMutableArray *array = [[NSArray alloc] initWithObjects:@"Title1", @"Title2", @"Title3", @"Title4", @"Title5", @"Title6", @"Title7", @"Title8", @"Title9", nil];
self.glossaryArray = array;
[array release];
}
因此,我使用该数组字符串手动创建了 9 个数据示例,但我想让事情变得更简单,如何使用 .plist 填充我的表视图文件?我有一个大的 plist 文件,我想将其加载到表视图中,但我不知道如何对其进行编码,希望我能得到帮助,
谢谢
hey guys,
I created a Table View with Navigation Controller, in a Tab Bar Application. This is the code I used to populate my Table View with data:
- (void)viewDidLoad {
[super viewDidLoad];
self.title = NSLocalizedString(@"Glossary", @"Back");
NSMutableArray *array = [[NSArray alloc] initWithObjects:@"Title1", @"Title2", @"Title3", @"Title4", @"Title5", @"Title6", @"Title7", @"Title8", @"Title9", nil];
self.glossaryArray = array;
[array release];
}
So there are my 9 data examples that I created manually using that array string, but I want to make things easier, how can I populate my Table View using a .plist file? I have a big plist file that I want to load into my Table View, but I don't know how to code it in, hope I can get help with this,
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您只需使用以下命令即可从 plist 创建数组:
要查找 plist 文件的路径,您可以使用
NSBundle
'sYou can create an array from your plist just by creating it with :
To find the path of your plist file, you can use
NSBundle
's