I've got a split-view application. When in Portrait orientation, there is a popover, it has a title "Root View Controller", how can I change it? moreover, how to skip 开发者_如何学Pythonpopover when I select a cell? thanks. Here is the screenshot:
in the ViewController set
self.navigationItem.title = @"The text you want";
and to "skip" the popover when a row is selected do sometime like this
- (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[self.navigationController dismissModalViewControllerAnimated:YES];
}
Find the view controller that will be the master view in the UISplitViewController and set the title in the viewDidLoad method like this:
self.title = @"Set Title";
Since the master view will eventually modify the detail view you can place a method in the detail view controller to dismiss the UIPopoverController after you select a row. Below is an example.
So in DetailViewController(Detail View) implement a method like this
- (void)setDetailDescription:(NSString *)text {
// Put code to update the detail view here
[self.popoverController dismissPopoverAnimated:YES];
}
And then in your RootViewController(Master View) implement this code
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
DetailViewController *dc = [self.splitViewController.viewControllers objectAtIndex:1];
[dc setDescription:@"Update detail view"];
}
Take note that your setup will vary so you will have to adapt this code to your project.
精彩评论