0

My application contains a Tab Bar Controller and Navigation controller. Its totally in Portrait mode. Now I have a table view in 2nd tab, clicking on each row of table view will push another view controller which will show a graphical chart, now I want this chart to be in landscape mode where as the rest of application is in portrait mode.

I came to know that we have to rotate the view on our own, now my question is how to rotate this new view in landscape mode. I put some UIView animations in viewWillAppear function, but I want the block-based animation to rotate this view to landscape for me and when I go back it rotate back portrait mode.

Thanks in advance !

Sohail
  • 2,058
  • 7
  • 33
  • 57
  • Please refer to [Previous Post][1] which may help you to get solution. [1]: http://stackoverflow.com/questions/6813899/is-it-possible-to-programatically-rotate-the-view-by-180-degrees – DShah Sep 27 '11 at 15:13

1 Answers1

1

Check the device orientation and make the rotation depends on it:

[UIView animateWithDuration:0.5f animations:^{ myView.transform = CGAffineTransformMakeRotation(-M_PI * 0.5); } ];
kv0
  • 914
  • 10
  • 14