0
A
回答
0
The simplest solution would be to render a UIImage behind the control to represent the track. The thumbknob can be changed with:
[mySlider setThumbImage:[UIImage imageNamed:@"thumb_image.png"] forState:UIControlStateNormal];
A side-effect of this is that the track isn't rendered unless you provide your own. This, combined with the UIImage, provide you with a custom UISlider without you having to subclass anything.
0
你是显示的控制是一个分段控制,你可以使用这段代码设置图像
UISegmentedControl* offlineSegment=[[UISegmentedControl alloc] initWithItems:[[[NSMutableArray alloc] initWithObjects:@"ON",@"OFF",nil] autorelease]];
[offlineSegment setFrame:CGRectMake(210,50,90,30)];
offlineSegment.tintColor=[UIColor greenColor];
offlineSegment.selectedSegmentIndex=0;
offlineSegment.segmentedControlStyle=UISegmentedControlStyleBezeled;
[locationSegment setImage:[UIImage imageNamed:@"onSelected.png"] forSegmentAtIndex:0];
[locationSegment setImage:[UIImage imageNamed:@"off.png"] forSegmentAtIndex:1];
[offlineSegment addTarget:self action:@selector(offlineSetting:) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:offlineSegment];
[offlineSegment release];
希望这将帮助你
0
我不知道,如果这将回答你的问题或不,但我已经看到这个项目的github,看起来像这样这样的
相关问题
- 1. 设置滑块图像
- 2. 在滑块上设置“SliderTrackThemeHeight”
- 3. get_children()并设置alt图像=滑块
- 4. 随机图像滑块设置z-index
- 5. 如何在JavaScript滑块容器上放置一个forground图像?
- 6. 将文字置于图像滑块上?
- 7. 如何 - 图像滑块
- 8. 在图像滑块上使用divs
- 9. 如何修复负载上的滑动滑块跳跃图像
- 10. 图片上传和图像滑块
- 11. 设置滑块值
- 12. 设置滑块值
- 13. 如何将引导滑块图像的位置设置为中心?
- 14. 如何在Nivo滑块中设置各个图像的宽度和高度?
- 15. 如何在jQuery中传递和设置滑块图像的显示时间?
- 16. 如何在EAGL VIEW上设置图像
- 17. 如何在UITabbaritem上设置图像?
- 18. 如何在图像上设置颜色?
- 19. 如何在图像上设置垂直
- 20. 如何在jlabel上设置图像?
- 21. 如何在QPushButton上设置图像?
- 22. 图像滑块在GWT
- 23. 图像不会在滑块
- 24. 如何在滑块更改的javascript上取消设置会话
- 25. 图像不显示在图像滑块
- 26. 图像滑块,带边框的图像:在滑块的图像是由后台
- 27. jQuery图像滑块
- 28. Android图像滑块
- 29. javascript图像滑块
- 30. CSS图像滑块
我有这个所需的滑块。 – iRam11
好,那么你需要继承UIView类,并需要在那里绘制滑块。然后你可以实现这一点,否则它不容易,不使用自定义实现 – Sabby
你可以给定代码如何定制滑块和添加段控制? – iRam11