我之前问过这个问题,我相信我问错了,所以我会更清楚。答案是非常周到和有用的,再一次。我想在我的 IOS Xcode 中知道...我有一个主/详细视图模板。我正在使用捆绑包中的 Plist 加载主表视图,但我正在更新文档文件夹中的 Plist...如何让这些更新反映在捆绑包中,以及如何刷新屏幕。可以的话请指教。先感谢您。问候,
这是我加载主表的代码...看起来有什么不正确的地方:我正在从 Documents 文件夹加载...但我没有从文档中获取所有记录:
NSLog(@"loading data");
self.navigationItem.title=@"Accounts";
// NSString *accountFile = [[NSBundle mainBundle] pathForResource:@"Accounts2" ofType:@"plist"];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentPath = [paths objectAtIndex:0];
NSString *plistPath = [documentPath stringByAppendingPathComponent:@"Accounts2.plist"];
accounts = [[NSMutableDictionary alloc] initWithContentsOfFile:plistPath];
account = [accounts objectForKey:@"Account"];
number = [accounts objectForKey:@"Number"];
dueDay = [accounts objectForKey:@"DayDue"];
minAmount = [accounts objectForKey:@"MinAmount"];
balance = [accounts objectForKey:@"Balance"];
NSLog(@"data loaded");
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
self.navigationItem.leftBarButtonItem = self.editButtonItem;
UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(insertNewObject:)];
self.navigationItem.rightBarButtonItem = addButton;