小编per*_*rap的帖子

启动方向错误

我是StackOverflow的新手,也是Objective-c的新手.

我已经试着寻找几个星期来找到一些东西给我一些暗示该做什么,但我似乎无法通过这个问题而不问问题.感觉它应该很简单,但......

我在旋转"rootView"控制器时遇到问题.它应该在横向上显示(在我决定使用导航控制器之前它已经完成).模拟器以正确的方向显示,但它已将视图旋转90度向左旋转,因此文本从下到上,侧向读取,因此您必须向左旋转头部.视图的最左侧部分是可见的,但视图的其余部分从屏幕顶部开始.这是一个大型的程序(我发现,一般来说,使用objective-c,但仍然享受它......),但这里是我认为重要的代码区域的要点:

在appDelegate中,我创建了一个窗口,我的rootViewcontroller和navcontroller:

// .h file:
UIWindow *window;
wordHelper3ViewController *viewController;
UINavigationController *navigationController;
Run Code Online (Sandbox Code Playgroud)

然后在实施中:

//.m file
- (BOOL)application:(UIApplication *)applicationdidFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    
    // Hide status bar
    application.statusBarHidden = YES;
        // --- Add the view controller's view to the window and display.
    [window addSubview:viewController.view];
    [window addSubview:navigationController.view];
    [window makeKeyAndVisible];
    return YES;
}
Run Code Online (Sandbox Code Playgroud)

然后我在dealloc中释放所有这些.

在我的根视图中,我这样做:

// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    // Return YES for supported orientations
    if (interfaceOrientation == UIInterfaceOrientationLandscapeRight){
        return YES;
    } else { …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c orientation

2
推荐指数
1
解决办法
8651
查看次数

标签 统计

iphone ×1

objective-c ×1

orientation ×1