Note that there are some explanatory texts on larger screens.

plurals
  1. PORootViewController's view is not beeing resized with auto layout
    text
    copied!<p>Hi when using autolayout on iOS 6, my "rootView" of my rootViewController doesnt seem to resize properly if at all.</p> <p>My rootViewController is loaded from a nib and i am adding it to the view-hierarchy like this:</p> <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible]; RootVC *rootVC = [[RootVC alloc] initWithNibName:@"RootVC" bundle:nil]; self.window.rootViewController = rootVC; return YES; </code></pre> <p>}</p> <p>But when i rotate the simulator the view of rootVC doesnt resize. Since you cant set any constraints to the "rootview" in a xib, I also tried this but without any effect:</p> <pre><code>- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions{ self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible]; RootVC *rootVC = [[RootVC alloc] initWithNibName:@"RootVC" bundle:nil]; self.window.rootViewController = rootVC; NSArray *vConst = [NSLayoutConstraint constraintsWithVisualFormat:@"V:|[view]|" options:0 metrics:nil views:@{@"view" : rootVC.view}]; NSArray *hConst = [NSLayoutConstraint constraintsWithVisualFormat:@"H:|[view]|" options:0 metrics:nil views:@{@"view" : rootVC.view}]; [self.window addConstraints:vConst]; [self.window addConstraints:hConst]; return YES; </code></pre> <p>}</p> <p>When i log-out the frame-size of the rootvc's view, it's always the portrait-format (w:768, h:1024)</p> <pre><code>- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation{ NSLog(@"%f, %f", self.view.frame.size.width, self.view.frame.size.height); </code></pre> <p>}</p> <p>could someone please tell me what i'm missing here? i've wasted hours with this problem and got nowhere^^</p> <p>thx</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload