Re: Hiding tab bar causes web content in pushed view to slide down
Re: Hiding tab bar causes web content in pushed view to slide down
- Subject: Re: Hiding tab bar causes web content in pushed view to slide down
- From: David Duncan <email@hidden>
- Date: Sat, 31 Oct 2015 15:40:33 -0700
Try doing the load in -viewWillAppear: instead. My guess is that the WKWebView is adding a UIScrollView when you load the content, and that scroll view is being modified after the fact when you can see it.
Alternatively you can try setting automaticallyAdjustsScrollViewInsets=NO on your view controller.
> On Oct 29, 2015, at 6:14 PM, Rick Mann <email@hidden> wrote:
>
> I have a tab bar application with a nav controller in each of the tabs. Clicking on an item in that pushes a new view controller with a WKWebView. Actually there's a UIView specified in IB, and in -loadView I create the WKWebView and add it to the UIView, and then add constraints to make it be the same size.
>
> Then in -viewDidAppear:, I load the web view content. This works fine.
>
> Now I changed the pushed controller so that it hides the tab bar on push. Now, when the web content loads, there's a gap between the top of it and the bottom of the nav bar (no gap along the bottom). You can see it slide from the right, then snap down. If I skip the load in -viewDidAppear:, I don't see it move, but of course the page is all the same color.
>
> I tried coloring the container view blue and the web view red. The view hierarchy inspector in Xcode does not appear to render the stack correctly (e.g. it shows the web content as completely off to the left).
>
> I finally solved this by a) removing the simulated nav bar in the pushed VC, and b) constraining the container view to the super view, not the top layout guide. I can't tell if this is causing the web content to appear under the nav bar, but that's not particularly critical in this case.
>
> The thing is, I feel like this is a bit of a hacked solution, and don't understand what's going wrong in the first place.
>
> --
> Rick Mann
> email@hidden
>
>
>
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
--
David Duncan
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden