UIWebView scrollsToTop and ignores UIEdgeInsets in iOS - ios

I basically have a Title bar with a UIWebView behind it. I have set the UIEdgeInsets of the UIWebView.scrollView to be such that the top of the Web page is at the bottom of the Title bar. Everything works as I expect except when the web page loads it moves the top of the UIWebView and ignores the UIEdgeInsets.
The behavior is particularly strange because while a web page is loading, parts of the web page are shown and are in the correct position (with the top of the web page just below the Title bar as it should be because of the UIEdgeInsets). However, once the web page completes loading it suddenly jumps up to the top of the UIWebView and ignores the UIEdgeInsets.
The workaround I am currently using is to set the contentOffset to the correct position immediately after the page loads, but this is not ideal because you can see it jumping to the top of the UIWebView then jumping back down to the bottom of the Title bar.
Does anyone know if there is something I can do to stop it jumping to the top of the UIWebView, either by forcing it to ignore the message to scroll to CGPointZero, or by setting the 'Start Position' to be the at the bottom of the title bar (please note, I have tried setting the origin to this point and it did not resolve the issue)?
Any help would be much appreciated.
Thanks

Related

Angular material fullscreen layout broken by Google Sign-In button

I'm trying to use the Google Sign-In button in a fullscreen Angular Material layout (based on https://github.com/angular/material-start), but as soon as it renders, the page layout grows just slightly taller than full screen. For example you can scroll down just a little bit past the supposedly full-height side navigation and see its drop shadow.
What is the button doing to my layout, and how do I fix fullscreen layout while using the button?
This can be fixed by adding a style to the embedding page, to display: none the iframe, which is otherwise a 1-pixel affair shoved offscreen to the side. In my testing it still does its job when completely hidden.

Placing a share button over a uiwebview

I have an rss app that I'm working on in xcode and the articles load up in a full screen web view. I need to place a "share" button in the navigation bar but since my uiwebview is full screen it won't show up when I run the app. I even tried cropping the top of the web view lower and placing the button there but still no luck. Here is an example of what I mean:
The share button needs to be on the right side of the navigation bar but i cannot seem to figure out how that make that work.
Thanks in advance
Fist of all, your top navigation bar seems to be missing (judging by your image). Since the nav bar is missing there is no possible way that the share button will be visible. You can do this is the IB or in your code.
For your IB you can move the view controller's 'layer's' so to speak. When you place all the elements down, your VC should look something like this:
On the left hand side we can see what subviews are at the top and which ones are at the bottom.
As we can see here that the UIWebView is at the top of the list, so it'll be at the bottom of the pile. The navigation bars are further down the list so they'll be at the top of the pile. So due to this they'll go over the UIWebView.
The other way to do this is using insertSubview:aboveSubview:. Fist of all you'll add your UIWebView using addSubview: and then add the nav bar using insertSubview:aboveSubview: and finally you'll add your button the someway as you did for the nav bar, but this time you'll be adding the button above the nav bar not the web view.
My best guess is that your forgetting to add another navigation bar to the top of the screen. Hope this helps!!

Why does iPhone 6 automatically scroll down web page content 64px on page refresh?

On the iPhone 6 when I type in my site's domain in the address bar and hit enter/GO, everything loads fine and the page is displayed and scrolled all the way at the top (as expected). However, right afterwards, if I refresh the page by hitting the refresh button, whenever the page loads, it is automatically scrolled/offsetted 64px from the top (a scroll event is actually fired as well). This seems to be the same height as the address bar. Any ideas how to prevent this?

Black line at bottom of elastic scrolling in uiwebview?

I have a hybrid iOS app that is essentially a uiwebview that loads HTML from our server. There's a fixed position top bar, a fixed position bottom tab bar, and a scrollable/draggable middle content section with content loaded via AJAX. However, sometimes a one-pixel, gray (#838383) line appears at the bottom of the middle content section when you scroll past the bounds of the content, ie, elastic scrolling. However, it's not consistent. In some tabs of the app, it doesn't show up at all, and I can't figure out what's causing it to appear or in some cases not appear. I've searched all the server-side CSS and HTML for "838383" but nothing turned up.
Normal state:
normal state http://msr-cf.matt.re/lio-app-line3.jpg
Elastic scrolling shows gray line:
scrolling with gray line http://msr-cf.matt.re/lio-app-line.jpg
Elastic scrolling on different page does not have gray line:
scrolling on a different tab does not have gray line http://msr-cf.matt.re/lio-app-line2.jpg
Has anyone experienced this before, know why it's happening, or have a solution?
This may slow down rendering a bit, but try the following:
webviewView.opaque = NO
You have to adjust UIWebView: set opaque NO and clear background color simultaneously:

Full Screen UIWebView without status bar cannot scroll to top

When I removed the top status bar, my UIWebView will not scroll to top, and understandably so. The question is how do I have the tap the top to scroll to top without the status bar?
I know Apple can do this when Safari is in full screen mode during Land scape. Tap to the invisible area, the content scrolls to top.
Anyone know how Apple does it?

Resources