Rotating view from landscape to portrait
I ma having a 开发者_开发问答view whose xib is in landscape mode.In my one view controller I want to show the view in landscape mode and it is working f9.In another view controller on a button click I want that view to come in portrait from bottom to top so basically I need to transform that landscape view to portrait view .I have done by shouldAuto rotate methodbut it does not work.i have attached the screenshot so that the question will be more understood
the landscape view is coming as it is . Please help me in sort outing this problem Thanks in advance!!
write the following code in view did load method
[[UIApplication sharedApplication] setStatusBarOrientation:UIInterfaceOrientationLandscapeRight animated:NO];
[[self view] setBounds:CGRectMake(0, 0, 480, 320)];
[[self view] setCenter:CGPointMake(160, 240)];
[[self view] setTransform:CGAffineTransformMakeRotation(M_PI / 2)];
Also In your XIB set the view frame as 480 X 320 in place of 320 X 480 . Otherwise it will not work You can also rotate your view in XIB.
精彩评论