0

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 understoodenter image description here

the landscape view is coming as it is . Please help me in sort outing this problem Thanks in advance!!

1 Answer 1

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.