Hello all. I'm developing a demo and as I'd never developed in objective-c, it's very difficult for me.
My question sure have a silly answer, but I cant find it in internet nor this and other forums...
Here I go.
I have a view with a label on the center and want the view to rotate when the device is rotated...
My code is quite simple:
But the result is not as I expect. What happens is the following:Code:- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return YES; } - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { switch (toInterfaceOrientation) { case UIInterfaceOrientationPortrait: [label setText: @"Portrait"]; break; case UIInterfaceOrientationPortraitUpsideDown: [label setText: @"Portrait Upside Down"]; break; case UIInterfaceOrientationLandscapeLeft: [label setText: @"Landscape Left"]; break; case UIInterfaceOrientationLandscapeRight: [label setText: @"Landscape Right"]; break; } }
In portrait mode, everything works fine, but in landscape mode, the view doesn't fill the screen... it remains with the same width as in portrait mode and it's very ugly...
I can't find what I'm missisng here!!!
Also, how do I relocate the label to position it in the center?
Thanks in advance.



LinkBack URL
About LinkBacks











Bookmarks