ios - WebView how can I lock the horizontal scroll? -
i webview fullscreen without being able scroll horizontal. both portrait , landscape orientation.
i'm new ios , don't know how works feel storyboard , xib confusing compare xmls of android. when open src code quite lot of code , can't figure out.
let me illustrate approach. consider untested pseudo-code.
@implementation myviewcontroller - (bool)shouldautorotatetointerfaceorientation:(uiinterfaceorientation)orientation { cgsize contentsize = self.webview.scrollview.contentsize; switch (orientation) { case uiinterfaceorientationportrait: contentsize.width = 320.0; self.webview.scrollview.contentsize = contentsize; return yes; case uiinterfaceorientationlandscapeleft: case uiinterfaceorientationlandscaperight: contentsize.height = 568.0; self.webview.scrollview.contentsize = contentsize; return yes; } return no; } @end
the idea here when underlying scroll view's content size fits screen dimensions scrolling should not possible. code reacts orientation changes (when device turned) , adjusts edge lengths respective screen dimensions.
one problem device has turned @ least once , after turning phone in both directions, contentsize
locked @ {320, 568}
. around this, consider this so.
Comments
Post a Comment