开发者

Change Detail View on selecting tab of Master view in split view controller

I am new to ipad development. In my application i have created splitview like the below image. In this how can i c开发者_运维技巧all another detailview controller when tabbar on the left pane selection changes??

Please help me..

Change Detail View on selecting tab of Master view in split view controller


You can simply replace the VC at index 1 of the UISplitViewController's viewControllers property. Try something like-

- (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
{
     UIViewController* myReplacementVC = nil;
      if(viewController == VC1)
           myReplacementVC = myReplacementVC1;
      else
           myReplacementVC = myReplacementVC2; 

      NSMutableArray* arr = [[NSMutableArray alloc] initWithArray:splitVC.viewControllers];
          [arr replaceObjectAtIndex:1 withObject:myReplacementVC]; //index 1 corresponds to the detail VC
          splitVC.viewControllers = arr;
          [arr release];
    }


This addressed the issue for me:

http://developer.apple.com/library/ios/#samplecode/MultipleDetailViews/Introduction/Intro.html#//apple_ref/doc/uid/DTS40009775-Intro-DontLinkElementID_2

and with Storyboards

http://www.raywenderlich.com/forums/viewtopic.php?f=2&t=1546

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜