UISegmentedControl选择状态图标图像 [英] UISegmentedControl selected state icon image

查看:93
本文介绍了UISegmentedControl选择状态图标图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何为 UISegmentedControl 状态设置图标图像。是 UISegmentedControl 真的缺少这个功能或它只是我失踪的技能?

How can I set the icon image for selected state of the UISegmentedControl. Is the UISegmentedControl really missing this functionality or it is just me missing skills?

有任何解决方法吗?

任何解答。

干杯,
Rafal

Cheers, Rafal

推荐答案

   [segmentedControl addTarget:self action:@selector(segmentAction:) forControlEvents:UIControlEventValueChanged];

-(void)segmentAction:(UISegmentedControl*)sender {

    [sender setImage:[UIImage imageNamed:@"image.png"] forSegmentAtIndex:sender.selectedSegmentIndex];

}

这篇关于UISegmentedControl选择状态图标图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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