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

查看:290
本文介绍了在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?

我们非常感谢任何帮助。

Any help will be greatly appreciated.

编辑:

我从代码片段中得到了这个想法,其中必须在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;


推荐答案

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


滚动指示器的样式。

The style of the scroll indicators.



@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天全站免登陆