简体   繁体   English

如何在iphone sdk中自定义tableview的滚动颜色?

[英]how to customize scroll color of tableview in iphone sdk?

I want to set scroll style to pink color in tableview.please give any suggestion for that.我想在 tableview 中将滚动样式设置为粉红色。请对此提出任何建议。

but only available from this colors但仅可从此 colors

    [tableview setIndicatorStyle:UIScrollViewIndicatorStyleWhite];

Replace UIScrollViewIndicatorStyleWhite to anything from this typedef.将 UIScrollViewIndicatorStyleWhite 替换为此 typedef 中的任何内容。

      typedef enum {
            UIScrollViewIndicatorStyleDefault,
            UIScrollViewIndicatorStyleBlack,
            UIScrollViewIndicatorStyleWhite
      } UIScrollViewIndicatorStyle;

For the moment is not possible set a custom color in the Scroll.目前无法在 Scroll 中设置自定义颜色。 the only posible colors are white and black.唯一可能的 colors 是白色和黑色。

http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIScrollView_Class/Reference/UIScrollView.html#//apple_ref/doc/uid/TP40006922-CH3-SW5 http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIScrollView_Class/Reference/UIScrollView.html#//apple_ref/doc/uid/TP40006922-CH3-SW5

This code works for me, Swift-3这段代码对我有用,Swift-3

 override func scrollViewDidScroll(_ scrollView: UIScrollView) {
        let verticalIndicator = scrollView.subviews.last as? UIImageView
        verticalIndicator?.image = nil
        verticalIndicator?.backgroundColor = UIColor.red
      }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM