How do I programmatically set the Return Key for a particular UITextField?

前端 未结 4 2011
情书的邮戳
情书的邮戳 2020-12-14 14:46

I can\'t believe that this question hasn\'t been asked yet, but I have been unable to find it so that is my assumption.

I have created custom UITableViewCel

4条回答
  •  生来不讨喜
    2020-12-14 15:41

    For the first UITextField, Read THIS tutorial on how to create a button on a Keyboard. You can learn the logic from there and use a Next button instead of Done button.

       //if you just want to make it appear NEXT//
    
        textField.returnKeyType = UIReturnKeyNext;
    

    And for the second UITextField, use...

       // for DONE //
    
        textField.returnKeyType = UIReturnKeyDone;
    

    You can in general create and rename the button to anything, and make sure you give the right IBAction on the event that that button is pressed. In case you do create your own custom button, look at the tutorial above to learn about placing it in the right coordinates and stuff.

提交回复
热议问题