iOS11 paged scroll view suddenly is scrollable vertically - uiscrollview

I have an app which uses EMPageViewController to display a set of onboarding slides. My understanding is that the underlying scroll view is using paged mode to display slides.
Upon update to iOS11, I see that suddenly the slides follow the finger, so they are draggable and bounce up and down. I expect paged scroll view to be scrollable horizontally only.
How can I restrict paged scroll view to horizontal scrolling only in iOS11 ?
I tried this but it did not work
pageViewController.scrollView.alwaysBounceVertical = false

This fixes the issue:
if #available(iOS 11.0, *)
{
self.scrollView.contentInsetAdjustmentBehavior = .never
}
The behavior for determining the adjusted content offsets. This
property specifies how the safe area insets are used to modify the
content area of the scroll view.
contentInsetAdjustmentBehavior is new from iOS 11 > and the default value is automatic.
Content is always adjusted vertically when the scroll view is the
content view of a view controller that is currently displayed by a
navigation or tab bar controller. If the scroll view is horizontally
scrollable, the horizontal content offset is also adjusted when there
are nonzero safe area insets.
Which made some of my UIScrollView scroll more than they were excepted to.

Related

iOS Swift: UIScrollView show scrollbar if needed (content height exceeds visible height)

I wanted to show the UIScrollView's scrollbar only when needed, i.e. when the content exceeds the visible size and needs scrolling to see everything.
So I added this code:
self.view.addSubview(self.myScrollView)
self.myScrollView.edgesToSuperView()
print(self.myScrollView.contentSize.height)
print(self.myScrollView.bounds.height)
if self.myScrollView.contentSize.height > self.myScrollView.bounds.height {
self.myScrollView.showsVerticalScrollIndicator = true
}
However, contentSize.height and contentSize.height always print out as zero, although that inside the scrollView there is a stackView that has many text labels that exceeded screen height. So this didn't worked out.
Any better ideas?
This property:
.showsVerticalScrollIndicator = true
only controls the visibility of a scroll indicator while the user is scrolling.
By default, if your content is not "tall enough" to need to scroll, the scroll indicators are never shown.
If your content IS "tall enough" to need to scroll (height is greater than the scroll view's frame height), the scroll indicators are shown while scrolling.
There is no way to have them "always showing."
If you want to indicate to the user that there is more content to be seen by scrolling, you could add something like "arrows" that you show / hide as appropriate, or, you can call `self.myScrollView.flashScrollIndicators() to "flash" the scroll indicators.

UIScrollView contentInset is set to nonZero when using autolayout

So I have the following view hierarchy :
A full size scrollView in my viewController's view with the following constraints :
These are the constraints on containerView (ignore the second last one, its a hacky semi-fix for my problem):
I have the status bar, the navigation bar and the tab bar visible.
The thing is that when I set a breakpoint to check the scrollView's contentInset, it shows 64 on top and 49 on bottom, left and right are zero.
There is no way to set contentInset in IB, I tried setting it in an IBAction to UIEdgeInsetZeio, but that didn't fix it either. This is screwing up my scrollview by adding space above and below my contentView, how can I fix this?
By default the view controller extends the view under the top navigation bar so your content will blur under a translucent navigation bar. This is controlled by edgesForExtendLayout which is managed in Storyboard via the Extend Edges setting.
By default, the scrollview will automatically adjust its content inset so the content appears below the top layout guide. This is controlled by automaticallyAdjustsScrollViewInsets which is also managed in Storyboard.
What you did was constrain the top of your scroll view to the top layout guide instead of the top of its superview. By doing this, you manually offset it by 64 points. However, the scrollview is still automatically insetting its content by 64 points, which is why you're seeing additional space above and below your scroll view.
Either constrain your scrollview to its superview (so its content scrolls under the top/bottom bars), or disable the view controller from automatically adjusting the scroll view inset.

embedded views lotus notes horizontal scroll bar

I have an interesting embedded view issue in lotus notes. I have the view embedded into a table cell and have turned off scrolling and extend last column options and the scroll bars don't display, everything looks good.
But as soon as I check the display actions option the horizontal scroll bar scows. I only have one button. Is there anything I can do to hide the scroll bar?
You can show or hide only both the scrollbars at once. Impossible to set a property for only one scrollbar.

UIScrollview scroll not working

UIScrollview scroll is not working when i tested application in device (iPhone 5), But scroll is working properly in iPhone 5/5s/6/6 Plus simulator. I am developing application using Xcode 6 and UIStoryboard with AutoLayout.
I set the top, bottom, left and right constraints of UIScrollview with relative to Superview. And i also set the constraints of every UIControl which is in the UIScrollview.
Has any one have solution regarding this issue?
Please see below screenshot for reference.
It's probably easiest to have the scroll view contain a single view, which then contains all of your scrollable content. That single view should be anchored to all 4 sides of the scroll view, and if it's only meant to scroll vertically (which is what your screenshot makes it look like), then set the content view to be the same width as the parent of the scroll view.
To make sure an UIScrollView scroll, you have to check
Size
Your content View is bigger than your Scroll View. If you want it to be scrolled vertically, make sure its higher; horizontally, wider.
Constraints
Make sure your Scroll View is pinned to its super view, Top, Bottom, Leading, Trailing.
Make sure your Content view of Scroll View DOES NOT have CenterY constraint set to Scroll View, cause that'd make content view stuck with Scroll View and it'd never be able to scroll. (That happens to me the last time I was stuck)
Interface Builder settings
Make sure the check in Interface Builder under Scroll View is checked:
Scrolling section, Scrolling Enabled.

NSScrollView do not display the horizontal scroll bar if displayed from a plugin in a browser

I am developing a web application that uses a plugin to display some native Content. I create a NSView(say A) and return the CALayer of the NSView to the browser for hosting on the browser window. Inside this NSView I host a NSScrollView; The ScrollView contains the actual document that needs to be scrolled(the size of the document is big enough that both the horizontal and vertical scroll bars need to be displayed). I am setting the bounds of the Host NSView(A) as the frame size on the NSScrollView properly; Also I made sure on the ScrollView I am setting setHasHorizontalScroller and setHasVerticalScroller as YES.
Though the veritical scroll bar is displayed in the viewer, the horizontal scroll bar is not getting displayed. I want to know what the error I am making and why the horizontal scrollbar is not displayed. Any clues/suggestions on this is greatly appreciated.

Resources