Is there a way to hide the scroll indicators in a

2019-01-21 10:22发布

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?

6条回答
Fickle 薄情
2楼-- · 2019-01-21 10:24

Swift 3 extension for UIScrollView and UITableView:

import Foundation

extension UIScrollView {
    func hideIndicators() {
        showsHorizontalScrollIndicator = false
        showsVerticalScrollIndicator = false
    }
}
查看更多
爷、活的狠高调
3楼-- · 2019-01-21 10:29

//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

查看更多
做自己的国王
4楼-- · 2019-01-21 10:31

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

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

Documentation - UIScrollView

查看更多
Juvenile、少年°
5楼-- · 2019-01-21 10:32

For those looking to do this in Swift.

self.tableView.showsHorizontalScrollIndicator = false
self.tableView.showsVerticalScrollIndicator = false
查看更多
来,给爷笑一个
6楼-- · 2019-01-21 10:38

These are your UITableView scrolling properties:

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

These are your UIScrollView scrolling properties:

[YourScroll setShowsHorizontalScrollIndicator:NO];
[YourScroll setShowsVerticalScrollIndicator:NO];
查看更多
祖国的老花朵
7楼-- · 2019-01-21 10:42

For UIScrollView in Swift

scrollView?.showsHorizontalScrollIndicator = false
scrollView?.showsVerticalScrollIndicator = false
查看更多
登录 后发表回答