我无法弄清楚问题是什么,我使用了 2 个教程和 Apple 给你的示例,但它仍然不会更新。我正在尝试修复此问题 4 天一些信息:我正在为这个项目使用故事板
Appdelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
UISplitViewController *splitViewController = (UISplitViewController *)self.window.rootViewController;
UINavigationController *navigationController = [splitViewController.viewControllers lastObject];
splitViewController.delegate = (id)navigationController.topViewController;
return YES;
}
主视图控制器.m
为控制器创建了一个属性(nieuwViewController)
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
SearchResult *searchResult = [searchResults objectAtIndex:indexPath.row];
NSLog(@"%@",searchResult);
self.nieuwViewController.searchResult =searchResult;
}
NieuwViewController.m
- (void)setSearchResult:(SearchResult *)newSearchResult
{
if (_searchResult != newSearchResult) {
_searchResult = newSearchResult;
// Update the view.
[self updateUI];
}
}
- (void)viewDidLoad
{
[super viewDidLoad];
NSLog(@"DETAIL VIEWDIDLOAD");
NSLog(@"%@",self.searchResult);
[self updateUI];
}
在updateUI中,我设置了所有标签等,但如果我也记录了它,它会被调用一次(当应用程序启动时)