开发者

for the query of methods of rotation

开发者 https://www.devze.com 2022-12-10 11:40 出处:网络
I have 1 UIViewController. in that i wrote, - (void)willRotate开发者_如何学GoToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration

I have 1 UIViewController.

in that i wrote,

- (void)willRotate开发者_如何学GoToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
   NSLog(@"A");
} in UIViewController.

- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
    NSLog(@"b");
}

but this method is not called why is it so?


You may need to do two things:

  1. Tell device to track orientation changes: call [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
  2. Implement your View controllers -shouldAutorotateToInterfaceOrientation method - return YES for orientations you want to support.
0

精彩评论

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