有没有办法隐藏UIScrollView中的滚动指示器?

时间:2009-05-04 20:14:25

标签: ios uiscrollview

我有一个用例,这些指标会干扰用户交互。我可以子类化和覆盖方法或执行类似的操作从滚动视图中删除滚动指示符吗?

7 个答案:

答案 0 :(得分:254)

showsHorizontalScrollIndicator的{​​{1}}和showsVerticalScrollIndicator属性设置为UIScrollView

NO

Documentation - UIScrollView

答案 1 :(得分:49)

//对于UITableView - Objective-C

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

//适用于UITableView - SWIFT 3.0

tbl.showsHorizontalScrollIndicator = false
tbl.showsVerticalScrollIndicator = false

//对于UIScrollView - Objective-C

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

//适用于UIScrollView - SWIFT

scrl.showsHorizontalScrollIndicator = false
scrl.showsVerticalScrollIndicator = false

从XIB或故事板改变

enter image description here

答案 2 :(得分:14)

对于那些希望在Swift中做到这一点的人。

self.tableView.showsHorizontalScrollIndicator = false
self.tableView.showsVerticalScrollIndicator = false

答案 3 :(得分:8)

对于Swift中的UIScrollView

scrollView?.showsHorizontalScrollIndicator = false
scrollView?.showsVerticalScrollIndicator = false

答案 4 :(得分:4)

这些是您的UITableView滚动属性:

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

这些是您的UIScrollView滚动属性:

[YourScroll setShowsHorizontalScrollIndicator:NO];
[YourScroll setShowsVerticalScrollIndicator:NO];

答案 5 :(得分:1)

boardSizestatic ArrayList<Knight> knightsOnBoard = new ArrayList<Knight>(); public static void main(String[] args) { Scanner s = new Scanner(System.in); int boardSize = s.nextInt(); int knights = s.nextInt(); for (int i = 0; i < knights; i++) { int x = (s.next().charAt(0) - 'a') + 1; int y = s.nextInt(); Knight newKnight = new Knight(new Position(x,y), boardSize); knightsOnBoard.add(newKnight); System.out.println("Knight at : " + newKnight.knightPosition.x + " " + newKnight.knightPosition.y); } ArrayList<Position> finalResults = GetAllDifferentPositions(); RemoveAllKnightPositions(finalResults); System.out.println("Positions: " + (finalResults.size() + knightsOnBoard.size())); s.close(); }

Swift 3.0扩展名:

UIScrollView

答案 6 :(得分:0)

没有答案对我有用,因为每次都会显示指标聚焦环,但是我通过NSStoryboard解决了我的问题。

NSCollectionView有一个图;

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

enter image description here

单击任何Scroller对象,然后在Attributes Inspector中将Focus Ring属性设置为None。如果未设置,则用户在AppearanceDark之间更改Light时可能会遇到问题。