Objective c checking whether text field is empty

后端 未结 8 1172
孤独总比滥情好
孤独总比滥情好 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:30

    The Most efficent way to do this is by using this

    // set it into an NSString
    NSString *yourText = yourVariable.text;
    
    if([theText length] == 0])
    {
     // Your Code if it is equal to zero
    }
    else
    {
    // of the field is not empty
    
    }
    

提交回复
热议问题