I am creating an iPad app with splitview, here is the screen shot,
In this one, I want to update the values in the righthand side tableview, when I change the tab in the masterview controller (left hand side). Which will be the good aproach, Should I load another viewcontroller for each tab change? Is it possible? Or just update the table? For all the tab changes i want to display a tableview with different data.
I used following code, i can see the changes in the log, but the table is not getting updated.
- (void)setDetailItem:(id)newDetailItem
{
if (_detailItem != newDetailItem) {
[_detailItem release];
_detailItem = [newDetailItem retain];
// Update the view.
[self configureView];
}
if (self.masterPopoverController != nil) {
[self.masterPopoverController dismissPopoverAnimated:YES];
}
}
- (void)configureView
{
// Update the user interface for the detail item.
if (isStudent) {
textStr = @"student";
NSLog(@"Student....%@",textStr);
[self.tableView reloadData];
}if (isTeachers) {
textStr = @"teacher";
NSLog(@"Teacher....%@",textStr);
[self.tableView reloadData];
}if (isPreference) {
textStr = @"preference";
NSLog(@"Preference....%@",textStr);
[self.tableView reloadData];
}if (isConfiguration) {
textStr = @"configuration";
NSLog(@"Configuration....%@",textStr);
[self.tableView reloadData];
}
}
我也尝试过
[self performSelectorOnMainThread:@selector(refreshTableView) withObject:nil waitUntilDone:NO];
请分享您的想法。
谢谢 :)
最后我自己发现了这个问题,并且我真的很高兴找到解决方案。我浏览了几个论坛和教程。最后我弄清楚了这个问题。而在这个,他们演示了如何使用 XCode 4.2 创建 SplitView 应用程序。在此例中,仅一行代码就解决了该问题。这是在 Appdelegate.m 文件中。默认情况下,MasterViewController 无法访问详细视图,因此如果我们需要在详细视图上执行某些操作,则必须连接 masterviewcontroller 和detailviewcontroller。看看视频,你(遇到同样问题的人)就会明白。
谢谢 :)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)