becomeFirstResponder not working in iOS 8

前端 未结 8 796
不知归路
不知归路 2020-12-09 03:55

I am using UITextField\'s method becomeFirstResponder to show the keyboard. This is working in iOS 7. But in iOS 8 this method doesn\'t show the keyboard.

 U         


        
8条回答
  •  不知归路
    2020-12-09 04:38

    Swift 3

    Here is the swift 3 version of the accepted answer. For me to get it to work I also had to add a delay.

    txtAddNew.perform(
        #selector(becomeFirstResponder), 
        with: nil, 
        afterDelay: 0.1
    )
    

提交回复
热议问题