iphone - 更改 UITableView、iPhone 中滚动条的宽度和颜色

标签 iphone uitableview scrollbar

我只能找到是否要显示滚动条或不使用

tableView.showsVerticalScrollIndicator = YES/NO;

但是如何自定义滚动条的颜色、宽度以及其他功能(如果可能)?

任何帮助将不胜感激。

编辑:

我从代码片段中得到了这个想法,其中必须在 MKMapKit 中找到 Google Logo 并将其重新定位到某个位置以使其保持可见。 通过以下方法,可以将自定义图像设置为 UItbaleview 的滚动条。但我没有发现任何关于改变滚动条大小的信息。

-(void) ViewDidLoad
{
UIImageView *testView = [self.tableView.subviews objectAtIndex:1];
    UIImage *Img = [UIImage imageNamed:@"image.png"];
    [testView setImage:Img];
}

编辑: 根据 Nekto 的建议,您可以使用以下内容来更改宽度。

CGRect frame = testView.frame; 
frame.size.width = 10; //set any value you want.
testView.frame = frame;

最佳答案

您只能设置滚动指示器的样式:

The style of the scroll indicators.

@property(nonatomic) UIScrollViewIndicatorStyle indicatorStyle

样式:

Scroll Indicator Style The style of the scroll indicators. You use these constants to set the value of the indicatorStyle style.

typedef enum {
    UIScrollViewIndicatorStyleDefault,
    UIScrollViewIndicatorStyleBlack,
    UIScrollViewIndicatorStyleWhite
} UIScrollViewIndicatorStyle;

例如:

tableView.indicatorStyle = UIScrollViewIndicatorStyleBlack;

关于iphone - 更改 UITableView、iPhone 中滚动条的宽度和颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7976593/

相关文章:

iphone - UITextView 周围的边框未显示

iOS Tableview Controller 键盘偏移量(里面的示例项目)

ios - UITableView 中自动选择错误的单元格?

css - 在 Firefox 59.0 中隐藏滚动条

iphone - cocos2d 和 XCode 4.5 : App suddenly in portrait orientation

iphone - 在 UIView 中显示相机提要

ios - 如何在 UICollectionViewCell 中显示 UITableView

c# - 在 WPF 中同步两个富文本框滚动条

iOS:有什么方法可以让 -webkit-overflow-scrolling 和::-webkit-scrollbar 一起工作吗?

c# - 开发客户端-服务器 iphone 应用程序