Objective c checking whether text field is empty

后端 未结 8 1362
孤独总比滥情好
孤独总比滥情好 2021-02-05 01:11

Here\'s the code:

- (IBAction) charlieInputText:(id)sender {
    //getting value from text field when entered
    charlieInputSelf = [sender stringValue];

           


        
8条回答
  •  半阙折子戏
    2021-02-05 01:19

    Simply checks for nil and if length of text length is greater than 0 - not empty

    if (textField.text && textField.text.length > 0)
    {
       /* not empty - do something */
    }
    else
    {
       /* what ever */
    }
    

提交回复
热议问题