Created
December 9, 2012 01:54
-
-
Save CVertex/4242947 to your computer and use it in GitHub Desktop.
WTF: ios6 PresentViewController:animated:completion is offset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// The presenting view controller method | |
- (void)showMyModal { | |
NSLog(@"is landscape : %d",UIInterfaceOrientationIsLandscape(self.interfaceOrientation)); // prints 'YES' | |
UIViewController* lvc = [[SampleViewController alloc] initWithNibName:nil bundle:nil]; | |
self.modalNavController =[[UINavigationController alloc] initWithRootViewController:lvc]; | |
self.modalNavController.modalPresentationStyle = UIModalPresentationFormSheet; | |
self.modalNavController.modalTransitionStyle = UIModalTransitionStyleCoverVertical; | |
//self.modalNavController.wantsFullScreenLayout = YES; | |
[self presentViewController:self.modalNavController | |
animated:YES | |
completion:^{ | |
}]; | |
[lvc release]; | |
} | |
//// The SAmple View Controller that does very little | |
#import <UIKit/UIKit.h> | |
@interface SampleViewController : UIViewController | |
@end | |
#import "SampleViewController.h" | |
@interface SampleViewController () | |
@end | |
@implementation SampleViewController | |
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil | |
{ | |
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; | |
if (self) { | |
// Custom initialization | |
} | |
return self; | |
} | |
- (void)pop{ | |
// TTOpenURL(@"tt://pad/tabs"); | |
} | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
// Do any additional setup after loading the view from its nib. | |
UIColor *randomColor = [UIColor colorWithRed:arc4random()%256/255. green:arc4random()%256/255. blue:arc4random()%256/255. alpha:1.f]; | |
self.view.backgroundColor = randomColor; | |
} | |
- (void)viewDidUnload | |
{ | |
[super viewDidUnload]; | |
} | |
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation | |
{ | |
return YES; | |
} | |
- (BOOL)shouldAutorotate { | |
return YES; | |
} | |
- (NSUInteger)supportedInterfaceOrientations { | |
NSLog(@"%d",UIInterfaceOrientationMaskAll); | |
return UIInterfaceOrientationMaskAll; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment