UIWebview in mode view mode is displayed in portrait mode in landscape mode

I looked through most of the questions and tried almost everything. But the bad part is that the problem still exists.

I have UIVIewone that always runs in landscape mode, and I present the second view ( detailView) as a full-screen modal view.

detailViewhas UIwebviewon top.

When I present detailViewas a modal view, the web view is displayed in portrait mode.

I return " YES" in shouldAutoRotateToInterfaceOrientation, and also has properties autoresize, autoresizingMaskand scalePageToFit.

When I rotate the device, and when it detailViewis in front, the web view is ordered correctly.

The problem is only what I first imagine modalView.

The rotation of the device adjusts the layout correctly.

+5
source share
4 answers

OK First of all, the question that I posted is not clear. My question was that when loading a web view, in portrait, it loaded the web view elements in landscape mode (CSS) and loaded as portrait mode (CSS) in landscape orientation.

It turns out that I am not applying the correct CSS style.

The fix I made was: In the ViewDidLoad and willAnimateRotation method, I send a notification to my javascript to update the orientation based style :)

0
source

, ModalViews iPhone Landscape View. iPhone 5.

, ModalView, WebView , .

DetailView ModalView,

+3

iOS 6, :

- (NSUInteger)supportedInterfaceOrientations {
    return UIInterfaceOrientationMaskLandscape;
}

- (BOOL) shouldAutorotate {
    return YES;
}

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
    return UIInterfaceOrientationLandscapeLeft;
}

, , , , - .

+1

:

CGAffineTransform transform = CGAffineTransformIdentity;
webView.transform = CGAffineTransformRotate(transform,-M_PI/2);
0

All Articles