Reputation: 97
I am using Xcode 10.1 and am programming using Swift in the ViewController.swift
file.
I have a horizontally scrolling UIStackView that works perfectly. The only issue is that the scrollbar appears whenever I begin to scroll. I looked online and there were plenty of tutorials on how to make similar UIStackViews but none of them explained how to hide the scrollbar. Does anybody know how to do this?
stackView.showsHorizontalScrollIndicator = false
Gives me the error
"Value of type 'UIStackView' has no member 'showsHorizontalScrollIndicator' "
Upvotes: 1
Views: 954
Reputation: 1046
showsHorizontalScrollindicator
is property of UIScrollView, but not the UIStackView
https://developer.apple.com/documentation/uikit/uiscrollview/1619380-showshorizontalscrollindicator
To hide scrollIndicator set this to false
for your scrollView
Upvotes: 0
Reputation: 3526
First thing is you need to call showsHorizontalScrollIndicator
On you scrollview. Second there are two ways of doing this : -
1 Programatically
// To hide vertical Indicator
scrollView.showsVerticalScrollIndicator = false
// To hide horizontal Indicator
scrollView.showsHorizontalScrollIndicator = false
2 By Storyboard
Select you scrollview and uncheck the following buttons
Upvotes: 1