UI picker as a lookup
I am trying to use a UI picker as a lookup. There is a textField called Author. user types there but he or she should have an option to do a lookup. So I put a button next to the textfield. User clicks the button I want the uipicker to appear with the list of items. I have been able to do this. I created a picker and populated. User clicks on the button and I popup the picker and change the inputview of the textbox to the picker. Picker shows up. Then when user selects from picker or clicks elsewhere I set the inputview to nil and picker to hidden. It all works well but then when I leave the view to go back to the previous view the picker appears and then dissapears. Am I doing this wrong? Should I create a separate view and place the picker there or do this differently? I am relatively new to IPHONE development.开发者_StackOverflow Is there a sample someplace in the internet that one of you guys will know?
Thanks a million. Saro
you need this link to create UIPickerView
Than set your picker popup code on button click, And one thing in mind check it when view disappear and didUnload is there pickerView displaying ?
Set one breakpoint and change the code according to your requirement.. May be this one help you This LInk
You can always create a separate view with UIPickerView, that always easy to deal with and declare view,picker as iVars.Whenever you want to show the picker view, just add the view as subView
and when you dont want to show it, remove the view by calling removeFromSuperview
.
hope this helps!!
精彩评论