我有一個主 - 細節應用程序,我想加載一個新的視圖,在主點擊行。如果我選擇第1行,則視圖不同,並且在選擇不同的行時,新視圖將顯示在Detail部分中。我怎樣才能做到這一點?如何在Master-Detail應用程序中加載完全不同的ViewController?
我正在做這樣的事情。問題是 - 如果我第一次選擇這兩行中的任何一行,視圖實際上會改變。但是,當我點擊另一行時,它不會改變。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.row==0){
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
TwitterTweetViewController *detailView=(TwitterTweetViewController *)[storyboard instantiateViewControllerWithIdentifier:@"TwitterDetailView"];
self.splitViewController.mainViewController = detailView;
[self.splitViewController.mainViewController viewDidLoad];
[self.splitViewController viewDidLoad];
}
if(indexPath.row == 1)
{
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
TwitterDetailViewController *detailView=(TwitterDetailViewController *)[storyboard instantiateViewControllerWithIdentifier:@"TwitterDetailView"];
self.splitViewController.mainViewController = detailView;
[self.splitViewController.mainViewController viewDidLoad];
[self.splitViewController viewDidLoad];
}
}
我應該爲了改變選擇這些行的看法呢?
這是你在找什麼? http://stackoverflow.com/questions/9272244/uisplitviewcontroller-on-ipad-with-storyboards – 2012-05-15 02:47:37