Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Objective c ios6中未调用新的定向方法_Objective C - Fatal编程技术网

Objective c ios6中未调用新的定向方法

Objective c ios6中未调用新的定向方法,objective-c,Objective C,最新版本的xcode 4.5中没有调用方向方法 (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customi

最新版本的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;
}
当我将UIViewController对象作为windows rootviewcontroller时,它会被正确调用。但是,当我将UINavigationController对象作为windows rootviewcontroller时,它不会被调用


请任何人帮我一下。

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

否。只是我创建了一个视图控制器,并将其添加到UINavigationController的rootviewcontroller,然后将UINavigationController对象添加到windows rootviewcontroller。以及我在视图控制器类中实现的方向回调。