ios - UIPicker as input for UITextfield keyboard -


initially wanted implement picker upon selecting uitableviewcell or uilabel.

the best approach 1. subclass uitextfield , set inputview picker. 2. make textfield becomefirstresponder in didselectrowatindexpath

answer below

the inputview attribute assign picker view textfield's first responder. won't display pickerview. therefore, warmuptextfield.inputview = picker should moved viewdidload().

what expect in didselectrowatindexpath set textfield first responder. code below function should work expect.

override func tableview(tableview: uitableview, didselectrowatindexpath indexpath: nsindexpath) {          if indexpath.section == 0 {              nametexfield.becomefirstresponder()          } else if indexpath.section == 1 {              warmuptextfield.becomefirstresponder()          }     } 

Comments

Popular posts from this blog

c# - ItextSharp font color issue in ver 5.5.4+ -

jquery - Multiple issues with pushstate: history, loading, calling functions -

ios - retrievePeripherals deprecated in IOS7 how to substitude it with retrievePeripheralsWithIdentifiers -