0

Orientation methods are not getting called in the latest version of xcode 4.5

(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    // Override point for customization after application launch.    

    self.sampleController =[[SampleViewController alloc]init];

    UINavigationController * nvC =[[UINavigationController alloc]initWithRootViewController:self.sampleController];

    self.window.rootViewController =nvC;

    [self.window makeKeyAndVisible];

    return YES;

}

(BOOL)shouldAutorotate{
    return YES;
}
(NSUInteger)supportedInterfaceOrientations{
       return UIInterfaceOrientationMaskAll;
}

when i take UIViewController object as windows rootviewcontroller,Its getting called properly.But,when i take UINavigationController object as windows rootviewcontroller,Its not getting called.

Would any one please help me on this.

4

1 回答 1

0

您可以将新控制器作为 UINavigationController 的子视图并在其中实现回调方法。然后将控制器用作窗口的rootviewcontroller。或者,如果您不喜欢创建新类,也可以使用类别来实现方法。

于 2012-09-22T14:51:42.703 回答