shouldAutoRotateToInterface issues with setting up frames
I have the following:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
float xCenter;
float yCenter;
if (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown){
NSLog(@"PORTRAIT ORIENTATION");
xCenter = 384;
yCenter = 512;
self.username.center = CGPointMake(xCenter, yCenter-60);
self.password.center = CGPoin开发者_如何学GotMake(xCenter, yCenter+10);
self.login.center = CGPointMake(xCenter, yCenter+110);
self.box.center = CGPointMake(xCenter, yCenter);
self.info.center = CGPointMake(xCenter, yCenter+70);
self.logo.center = CGPointMake(xCenter, yCenter-600);
}
}
The NSLog prints correctly however it does not set all the center's. I have to change orientation to landscape and then back to portrait to have this into effect. Why is this? How do I make it to affect on the first load/app launch?
shouldAutorotateToInterfaceOrientation:
is called prior to any rotations. It is called to verify which orientations are supported to see if it needs to rotate. You will have to use the methods listed here
.
精彩评论