我有一个由用户在我的应用程序中填充的 plist。我正在尝试在 UITableView 中显示该 plist 的内容,直到应用程序重新启动后才会显示,这意味着它不会更新。这是我所拥有的:
- (void)viewDidLoad
{
[super viewDidLoad];
// Uncomment the following line to preserve selection between presentations.
// self.clearsSelectionOnViewWillAppear = NO;
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
NSString *path = [[NSBundle mainBundle] pathForResource:@"foodList" ofType:@"plist"];
arrayFood = [[NSMutableArray alloc]initWithContentsOfFile:path];
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.tableView reloadData];
NSString *path = [[NSBundle mainBundle] pathForResource:@"foodList" ofType:@"plist"];
arrayFood = [[NSMutableArray alloc]initWithContentsOfFile:path];
}
提前致谢!