MrD*_*ase 4 uitableview uislider ios
我想编程方式创建自定义UITableViewCell
用UISlider
在中心和两个图像在两端.有关示例,请参阅任何iOS设备上的亮度设置.它的中心有一个UISlider,两端有两个类似太阳的图像(一个小,一个大).这基本上就是我所说的:
以编程方式创建此自定义的最简单方法是UITableViewCell
什么?
干杯!
Ano*_*mie 14
在UISlider的任何一端添加图像的最简单方法是使用setMinimumTrackImage:forState:
和setMaximumTrackImage:forState:
.
要将UISlider添加到UITableViewCell,只需将其添加为单元格的子视图contentView
,并根据需要设置滑块frame
(或bounds
和center
)autoresizingMask
.
[cell.contentView addSubview:slider];
slider.bounds = CGRectMake(0, 0, cell.contentView.bounds.size.width - 10, slider.bounds.size.height);
slider.center = CGPointMake(CGRectGetMidX(cell.contentView.bounds), CGRectGetMidY(cell.contentView.bounds));
slider.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
Run Code Online (Sandbox Code Playgroud)
忽略细胞的imageView
,textLabel
和detailTextLabel
性能; 如果您从未访问过这些属性,则单元格可能甚至无法创建相应的视图.
归档时间: |
|
查看次数: |
5565 次 |
最近记录: |