I have a scenario where we need to present the user with a question that has three possible answers. Yes/No/Don't know. Normally on a web form I would us开发者_开发问答e three radio buttons for this. What - in your opinions - would be the best solution for an iPhone native app...
I looked at the segmented control but it doesn't quite seem to fit the bill (this control normally changes the view in some way I believe).
I'm just looking for some feedback from the community before we go ahead with this...
Thanks, Deano.
Just to clarify your wrong belief abt segment control.
Segmented control can definitely serve your purpose. Please have a look at documentation and also you can follow this sample application which shows use of segmented control.
In your case You want use for multiple answers acting as radio button group, if your answer is too much long enough to be fit in UIPickerView in that case UIPickerView will also can not be used.
So you need to look alternative solution like have radio button kind of image and put UIButtons ahead of each answers and wire up Touchup Inside event of all the buttons in single action and act accordingly which is being selected from sender tag property.
Hope it helps.
How about UIPickerView? See the class reference for more details.
Just use three UIButton
's. You'll need to create at least two states for these buttons: Selected and Normal. The selected state should have a tick or some other indicator by it. When the user touches one of the buttons, change the Selected
property of that button to YES
and the other two's to NO
. This will emulate the radio button effect you have on your web form.
However, if you want to stay true to iPhone selection then you'd probably be better of going with a UIPickerView
.
精彩评论