134

I've got a use case where those indicators disturb the user interaction. Can I subclass and override a method or do something similar to remove the scroll indicators from the scroll view?

Pang
  • 8,605
  • 144
  • 77
  • 113
Thanks
  • 39,247
  • 69
  • 202
  • 315

7 Answers7

276

Set the showsHorizontalScrollIndicator and showsVerticalScrollIndicator properties of the UIScrollView to NO.

[tableView setShowsHorizontalScrollIndicator:NO];
[tableView setShowsVerticalScrollIndicator:NO];

Documentation - UIScrollView

Pang
  • 8,605
  • 144
  • 77
  • 113
retainCount
  • 4,338
  • 1
  • 20
  • 14
  • As learnt from Docs,you can even use it for scrollview directly! [scrollview setShowsHorizontalScrollIndicator:NO]; Thanks to @retainCount – Rajal Jan 22 '15 at 07:17
  • 1
    As of iOS 11, this should be called in viewWillAppear, it doesn't work if called in viewDidLoad – melvinto Mar 08 '18 at 17:38
65

//For UITableView - Objective-C

tbl.showsHorizontalScrollIndicator = NO;
tbl.showsVerticalScrollIndicator = NO;

//For UITableView - SWIFT 3.0

tbl.showsHorizontalScrollIndicator = false
tbl.showsVerticalScrollIndicator = false

//For UIScrollView - Objective-C

scrl.showsHorizontalScrollIndicator = NO;
scrl.showsVerticalScrollIndicator = NO;

//For UIScrollView - SWIFT

scrl.showsHorizontalScrollIndicator = false
scrl.showsVerticalScrollIndicator = false

Change from XIB or storyboard

enter image description here

Bhavesh Nayi
  • 3,548
  • 1
  • 25
  • 41
18

For those looking to do this in Swift.

self.tableView.showsHorizontalScrollIndicator = false
self.tableView.showsVerticalScrollIndicator = false
davidrayowens
  • 1,502
  • 1
  • 13
  • 23
10

For UIScrollView in Swift

scrollView?.showsHorizontalScrollIndicator = false
scrollView?.showsVerticalScrollIndicator = false
mattyU
  • 1,146
  • 1
  • 16
  • 18
5

Swift 3.0 extension for UIScrollView and UITableView:

import Foundation

extension UIScrollView {
    func hideIndicators() {
        showsHorizontalScrollIndicator = false
        showsVerticalScrollIndicator = false
    }
}
Bhavesh Nayi
  • 657
  • 3
  • 15
Roman Barzyczak
  • 3,510
  • 1
  • 28
  • 43
  • 2
    Why the Hell are you using an extension ? You're complicating things with useless lines of code for people who are trying to learn, when a simple view.showsHorizontalScrollIndicator = false would work… – petaire Jun 17 '17 at 08:32
  • 2
    @petaire -- You need to calm down lol. I actually really like that extension. – quemeful Nov 21 '17 at 18:11
  • Extensions are too overkill for this, please use these settings directly. – Pedro Paulo Amorim Dec 18 '19 at 11:11
4

These are your UITableView scrolling properties:

[YourTableView setShowsHorizontalScrollIndicator:NO];
[YourTableView setShowsVerticalScrollIndicator:NO];

These are your UIScrollView scrolling properties:

[YourScroll setShowsHorizontalScrollIndicator:NO];
[YourScroll setShowsVerticalScrollIndicator:NO];
Cesare
  • 8,326
  • 14
  • 64
  • 116
Darshan Kunjadiya
  • 3,267
  • 1
  • 26
  • 31
0

No answers have worked for me because the focus ring of indicators is shown every time but I solve my problem via NSStoryboard.

NSCollectionView have a diagram;

Scroll View - Collection View then Clip View then Scroller (vertical) & Scroller (Horizontal)

enter image description here

Click any Scroller object then in Attributes Inspector set Focus Ring property to None. If you have not set it you can have a problem when users change the Appearance between Dark and Light.

eemrah
  • 1,277
  • 1
  • 11
  • 25