0
votes

I want to play a YouTube Video in a UIWebView in fullscreen (Landscape mode) But all my other views to be only in Portrait mode. How is it possible that only the YouTube video is in landscape mode?

Do I have to enable the landscape mode in the app targets summary?

Thanks for help! :-)

2
One thing I can suggest is, transform and rotate your view with 90 degree rotation. It is specific to your webview screen only. Also use auto layout or auto resize subviews property to resize your webview accordingly.Mrunal
Read the documentation of UIViewController before posting a question.nsgulliver

2 Answers

1
votes

If your app is using multiple orientations then you need to define them in the Project Target summary. e.g Portrait, Landscape left & Landscape right.

If you are having your device working for iOS5, use the following method(deprecated in iOS6) for rotating to particular orientation.

  - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation

If you are having your device working on iOS6. you should use the following methods.

– shouldAutorotate – supportedInterfaceOrientations & – preferredInterfaceOrientationForPresentation

If your app supporting both versions then you could keep the both methods and check if your view controller is responding to the particular method by

if ([self respondsToSelector:@selector(methodToCheck)])
1
votes
myTableView.autoresizingMask =   UIViewAutoresizingFlexibleHeight|UIViewAutoresizingFlexibleWidth;

CGAffineTransform rotate = CGAffineTransformMakeRotation(1.57079633);
[myTableView setTransform:rotate];
self.view = myTableView;

This will also work*

make sure here i have done in tableview