iPhone应用程序中的单选按钮 [英] Radio button in iPhone app

查看:106
本文介绍了iPhone应用程序中的单选按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在iPhone应用程序中添加单选按钮。为此我得到了圆形的单选按钮图像。我可以将该图像添加为子视图吗?我可以在UIImage中添加touchupinside事件吗?

I have to add radio buttons in my iPhone application. For that I have got radio button image which is of round in shape. Can I add that image as a subview? and Can I add touchupinside event to UIImage?

推荐答案

iPhone应用程序没有单选按钮。 类似iPhone的方法是使用选择器视图,或者在分组表视图中使用检查附件在选定行上显示多行。

iPhone apps do not have radio buttons. The "iPhone-like" way to do this is either by using a picker view or by having several rows in a grouped table view with a check accessory on the chosen row.

如果由于某种原因你真的觉得需要有单选按钮,请使用带有自定义按钮类型的UIButton。将空心圆设置为正常控制状态的图像,将实心圆圈设置为选定状态的图像。

If for some reason you really, really feel the need to have radio buttons, use a UIButton with a button type of custom. Set the empty circle as the image for the "normal" control state and the filled circle as the image for the "selected" state.

这篇关于iPhone应用程序中的单选按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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