xcode 在 iPhone 应用程序中使用单选按钮
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5139005/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Using radio buttons in iPhone app
提问by Jr Ntr Achanta
How do I a use radio button in an iPhone app? Should I load any image instead of button image?
如何在 iPhone 应用程序中使用单选按钮?我应该加载任何图像而不是按钮图像吗?
回答by David Schlesinger
A fairly standard replacement for radio buttons on iOS is a "picker". An alternative, if you have a large number of potential choices, is to use a static list under a button, and allow only one of the items to be selected and checkmarked.
iOS 上单选按钮的一个相当标准的替代品是“选择器”。如果您有大量潜在选择,另一种方法是在按钮下使用静态列表,并且只允许选择和选中其中一个项目。
回答by Swastik
You can use a custom button & change its image on button click
您可以使用自定义按钮并在单击按钮时更改其图像
回答by makdad
Take a look at the UISegmentedControl. It functions basically as a radio button for up to ~4 options. There's no maximum limit AFAIK, but any more than 4 is somewhat difficult visually.
看一看UISegmentedControl。它的功能基本上是一个单选按钮,最多可以有 4 个选项。AFAIK 没有最大限制,但超过 4 个在视觉上有些困难。
回答by David Liu
Try DLRadioButton, the best Radio Button control for iOS. It is highly customizable, you can also use you own image as selection indicator. It is available through Cocoapods pod 'DLRadioButton', '~> 1.4'and at GitHub.
试试DLRadioButton,iOS 上最好的单选按钮控件。它是高度可定制的,您还可以使用自己的图像作为选择指示器。它可以通过 Cocoapodspod 'DLRadioButton', '~> 1.4'和GitHub 获得。
Screenshot for your reference.
截图供您参考。


