Three20 + iPad on iOS 6 launch in landscape mode
Previously I posted an article regrading modifying Three20 code to support rotation on iOS 6 applications. (Three20 + iOS 6 Rotation)
Here I'm going to post another issue caused by Three20 and the solution.
The issue only happens on iPad running iOS 6 and launching in landscape mode. The reason is on iPad the status bar could be in landscape mode before launching the app. And that causes Three20 apps to create an incorrect size of root window.
Here is the solution (with diff). Modify -(UIWindow*)window in TTBaseNavigator.m
- (UIWindow*)window { if (nil == _window) { UIWindow* keyWindow = [UIApplication sharedApplication].keyWindow; if (nil != keyWindow) { _window = [keyWindow retain]; } else { - _window = [[[self windowClass] alloc] initWithFrame:TTScreenBounds()]; + _window = [[[self windowClass] alloc] initWithFrame: + [UIScreen mainScreen].bounds]; [_window makeKeyAndVisible]; } } return _window; }
And also to support rotation, you need to do 1. and 3. in this post (Three20 + iOS 6 Rotation). And not necessary to do 2. Instead you could do the following change.
Modify setRootViewController in TTBaseNavigator.m (with diff)
- (void)setRootViewController:(UIViewController*)controller { if (controller != _rootViewController) { [_rootViewController release]; _rootViewController = [controller retain]; if (nil != _rootContainer) { [_rootContainer navigator:self setRootViewController:_rootViewController]; } else { - [self.window addSubview:_rootViewController.view]; + if ([self.window respondsToSelector:@selector(setRootViewController:)]) { + [self.window setRootViewController:_rootViewController]; + } + else { + [self.window addSubview:_rootViewController.view]; + } } } }









