Iphone 拆分视图应用程序,如何更改popover的标题?
我有一个分割视图应用程序。当处于纵向时,有一个popover,它有一个标题“根视图控制器”,如何更改它?此外,当我选择一个单元格时,如何跳过弹出窗口?谢谢以下是截图:Iphone 拆分视图应用程序,如何更改popover的标题?,iphone,objective-c,uisplitviewcontroller,Iphone,Objective C,Uisplitviewcontroller,我有一个分割视图应用程序。当处于纵向时,有一个popover,它有一个标题“根视图控制器”,如何更改它?此外,当我选择一个单元格时,如何跳过弹出窗口?谢谢以下是截图: 在ViewController集合中 self.navigationItem.title = @"The text you want"; 要在选中一行时“跳过”弹出框,请执行以下操作 - (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NS
在ViewController集合中
self.navigationItem.title = @"The text you want";
要在选中一行时“跳过”弹出框,请执行以下操作
- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[self.navigationController dismissModalViewControllerAnimated:YES];
}
- (void)setDetailDescription:(NSString *)text {
// Put code to update the detail view here
[self.popoverController dismissPopoverAnimated:YES];
}
在UISplitViewController中找到将成为主视图的视图控制器,并在viewDidLoad方法中设置标题,如下所示:
self.title = @"Set Title";
由于主视图最终将修改局部视图,因此可以在局部视图控制器中放置一个方法,以便在选择行后关闭UIPopoverController。下面是一个例子
因此,在DetailViewController(详细视图)中实现如下方法
- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[self.navigationController dismissModalViewControllerAnimated:YES];
}
- (void)setDetailDescription:(NSString *)text {
// Put code to update the detail view here
[self.popoverController dismissPopoverAnimated:YES];
}
然后在RootViewController(主视图)中实现此代码
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
}
请注意,您的设置会有所不同,因此您必须根据您的项目调整此代码