开发者

shouldAutoRotate method not working properly..?

I have used multiple uiviewcontrollers in my split view based ipad application. There are web services. For some particular web services (e.g Logout) i need to remove split view and insert new view i.e Login Screen. but most of times shouldAutoRotate method of Login view d开发者_StackOverflowoesnt gets called resulting in dumb app which do not rotate. What may be the reason behind that? What should I do?


to maintain my legacy code I added this.

- (BOOL)shouldAutorotate{
    UIDeviceOrientation orientation = [UIDevice currentDevice].orientation;
    if (orientation == UIDeviceOrientationUnknown) return YES;
    BOOL result = [self shouldAutorotateToInterfaceOrientation:orientation];
    return result;
}

then the original code returns the valid autorotation information.


Make sure you have not extract a UIView from your UIViewController which shouldAutorotateToInterfaceOrientation: function return YES, and then add the UIView into another UIView use addSubView. I have encountered it before.


Make sure all your view controllers return YES for shouldAutorotateToInterfaceOrientation: for your iPad build -- at least the ones that are visible at that time.

See: iPad orientation change issue

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜