ios - Save the value in UIpickerview once done editing -
i need number 4.
- select
uitextfield
, showuipickerview
(check) - select value in
uipickerview
, display inuitextfield
(check) - click on screen , move focus
uitextfield
,uipickerview
disappear (check) - click on
uitextfield
, displays selected value inuitextfield
uipickerview
starting point (row 0).
here code:
@ibaction func textfieldediting(sender: uitextfield){ var numberpicker:uipickerview = uipickerview() var row:int = 0 numberpicker.delegate = self desiredtext?.inputview = numberpicker numberpicker.selectrow(79, incomponent: 0, animated: true) //desiredtext?.text = pickoption[79] } func numberofcomponentsinpickerview(pickerview: uipickerview) -> int{ return 1 } func pickerview(pickerview: uipickerview, numberofrowsincomponent component: int) -> int{ return pickoption.count } func pickerview(pickerview: uipickerview, titleforrow row: int, forcomponent component: int) -> string! { return pickoption[row] } func pickerview(pickerview: uipickerview, didselectrow row: int, incomponent component: int){ desiredtext!.text = pickoption[row] }
Comments
Post a Comment