I have a view in my app (iOS7) where a have such a view controllers hierarchy ViewController->childViewController->childViewController->myChildViewController.
myChildViewController has a full sized UIWebView on it. I have a UIButton to hide UIToolBar from one of childViewController. When I press the button - UIWebView scrollView changed its content offset by status bar hide. How to avoid this behavior?
Add a comment
|
2 Answers
That should only happen if you've made the UIWebView the main view, such as
viewController.view = webView;
If you make it a subview instead, it should ignore the offsets:
webView.frame = viewController.view.bounds;
webView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight
[viewController.view addSubview:webView];
It may also change if the parent view controller is resized...
Another thing you can try in the view controller that holds the web view:
[viewController setAutomaticallyAdjustsScrollViewInsets:NO];
5 Comments
Alexander Slabinsky
My 'UIWebView' is not a 'myViewController.view' it's on 'myViewController.view.contentView'. I tried to set "automaticallyAdjustsScrollViewInsets" to 'NO' but that didn't work for me.
jjv360
What's the type of the view controller?
Alexander Slabinsky
'UIViewController'->'UINavigationContoroller'->'UIViewController'->'MyViewController with UIWebView'
jjv360
As far as I know,
UIView doesn't have a contentView property... What's the superclass of your MyViewController?Alexander Slabinsky
Yes.
UIViewController doesn't have contentView property. It's a simple UIView instance above self.view in UIViewController. It is used for simple size manage via margin. But I checked the size and tried to remove all margins from it. That didn't help.