iPad Orientations

ぃ、小莉子 提交于 2020-01-07 08:54:28

问题


Ok here is the structure of the app:

in delegate, i add rootViewController as subview to the window:

RootViewController *rootView = [[RootViewController alloc] init];

[window addSubview:rootView.view];

In rootViewController there is an inteface I crate programmatically (a brunch of buttons like the springboard), and is currently working only in portrait mode.

When I add:

- (BOOL)shouldAutorotateToInterfaceOrientation: (UIInterfaceOrientation)interfaceOrientation
{

    NSLog(@"we are here");

    return YES;


}

nothing happens, its called just when the app runs, and not when I change orientations.

So what I miss ? How I will make my View controller rotate based on orientation?

thanks for any help.


回答1:


You should configure your Info.plist correctly

Check if the UISupportedInterfaceOrientations~ipad (Supported interface orientations (iPad)) array is present, if not add this node and the orientations you want to be supported in your app.




回答2:


Ok, i have found the solution

Looks like based on the apple docs I have to add the RootViewController as retainable property and then orientations work as it should.

Thanks for the help anyway.



来源:https://stackoverflow.com/questions/3565541/ipad-orientations

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!