开发者

Handle orientation changes in a UIViewController directly subviewed on the key window

开发者 https://www.devze.com 2023-03-19 14:08 出处:网络
I am trying to sub view a viewcontroller\'s view on key window of my application. I need to do it like in such a way that, from the app I will take the keywindow using [[UIApplication sharedApplicatio

I am trying to sub view a viewcontroller's view on key window of my application. I need to do it like in such a way that, from the app I will take the keywindow using [[UIApplication sharedApplication] keyWindow] and then will sub view a viewcontroller's view to that window. But I am no开发者_开发百科t getting orientation changes in shouldRotateToInterface method of that viewcontroller. It fires once on initialization and one on dealloc but does not get fired on rotating the device.

Do I need to do any other method, How can I do transform of a view controller's view as the device orientation changes?.. Please give me tutorial if possible.

Thank you in advance :)


It's a bit unclear with your terminology being a bit off in places but the procedure you normally follow in your app delegate is:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    self.window.rootViewController = self.yourViewController;
    self.window makeKeyAndVisible];
    return YES;
}

This is taken from the Apple templates when you create a new project in xcode. This should be all you need to get your shouldRotateToInterface method and various other methods called.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号