I have a table view & I have to display text fields in some cells. When user click on the text field, I want the picker view to be displayed with integer values from 0 to 99. once the user selects the item in picker view the same needs to be displayed on that particular text field. Any help would be sincerely appreciated.
相关问题
- CALayer - backgroundColor flipped?
- Core Data lightweight migration crashes after App
- Core Data lightweight migration crashes after App
- How can I implement password recovery in an iPhone
- State preservation and restoration strategies with
相关文章
- 现在使用swift开发ios应用好还是swift?
- UITableView dragging distance with UIRefreshContro
- Could I create “Call” button in HTML 5 IPhone appl
- TCC __TCCAccessRequest_block_invoke
- Where does a host app handle NSExtensionContext#co
- xcode 4 garbage collection removed?
- Xcode: Is there a way to change line spacing (UI L
- Unable to process app at this time due to a genera
Create a picker view and implement the delegate and datasource methods in your view controller. Set the picker view as the
inputview
of your text field. It will then pop up instead of the keyboard when the user edits the text field.Use the
didSelect...
delegate methods to update the text field value when the user alters the picker.First in the viewDidLoad method you need to instantiate the PickerView and to add it to the textField
Then you have to implement the UIPickerView delegate
Where arrayWithData is the array with the source for the PickerView.
Add target of this line to ur textfield function
Swift iOS: (Note: please change vars name by requirement)
Step 1 : declare vars and objects
Step 2: declare delegates and protocol: