更改 UITableView 中滚动条的宽度和颜色,iphone [英] Change width and colour of scroll bar in UITableView, iphone

查看:79
本文介绍了更改 UITableView 中滚动条的宽度和颜色,iphone的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I could only find if one wants to display scroll bar or not using

tableView.showsVerticalScrollIndicator = YES/NO;

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

but how can I customize the scroll bar for colour, width and if possible other features?

任何帮助将不胜感激.

我从代码片段中得到了这个想法,人们必须在 MKMapKit 中找到 Google 徽标并将其重新定位到某个地方,以便它保持可见.通过以下方法可以将自定义图像设置为 UItbaleview 的滚动条.但我没有发现改变滚动条的大小.

I got this idea from code snippets where one must find Google logo in MKMapKit and relocate it somewhere so that it remains visible. by following method one can set custom image to scroll bar of UItbaleview. But I found nothing on changing size of scroll bar.

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

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

As suggested by Nekto you can use following to change width.

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

推荐答案

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

滚动指示器的样式.

@property(nonatomic) UIScrollViewIndicatorStyle indicatorStyle

样式:

滚动指示器样式滚动指示器的样式.您可以使用这些常量来设置 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;

这篇关于更改 UITableView 中滚动条的宽度和颜色,iphone的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆