Search code examples
objective-cxcodeipadios4uisplitviewcontroller

Splitview controller error in ios 4


I am new to iPhone development. I am working on a project having split view controllers. What I am doing is as follows

[self.splitViewController removeFromParentViewController];
     self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
     UINavigationController *detailViewNav=[[UINavigationController alloc]initWithRootViewController:SampleViewController];

   self.nextSplitControler=[[UISplitViewController alloc]init];
    self.nextSplitControler.viewControllers=[NSArray arrayWithObjects:masterNavigationController,detailViewNav, nil];
    self.nextSplitControler.delegate=SampleViewController;
    self.window.rootViewController=self.nextSplitControler;

    [self.window makeKeyAndVisible];

It works fine on iOS 5.0 . But on iOS 4.3 it throws an error as

-[UISplitViewController removeFromParentViewController]: unrecognized selector sent to instance.

Can any one help me with this issue? I am banging my head.


Solution

  • Don't bang your head; check the docs. :)

    - (void)removeFromParentViewController

    Availability

    Available in iOS 5.0 and later.