我只能找到是否要显示滚动条或不使用
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/