Get label value and check whether equal to some string

Discussion in 'iOS Programming' started by RutgerB, Mar 27, 2009.

  1. RutgerB macrumors newbie

    Joined:
    Jul 13, 2008
    #1
    Hi


    I have a label called currentInput. I want to get the value of the label and check whether it is equal to e.g. "hello".

    I hope I've provided enough information.. I'm new to iPhone developement (I do have a lot of experience with Java and C)


    Thanks

    Rutger Bevers
     
  2. Jeremy1026 macrumors 68020

    Jeremy1026

    Joined:
    Nov 3, 2007
    #2
    Code:
    if ([currentInput.text isEqualToString:@"Hello"]) {
         NSLog(@"Match");
    }
    else {
         NSLog(@"No Match");
    }
     
  3. RutgerB thread starter macrumors newbie

    Joined:
    Jul 13, 2008
    #3
    This gives an error:

    Request for member 'text' in something not a structure or an union.

    I assume the code is right, but something else is wrong with my application.
    Any idea?

    Fixed it
    In the header file:
    IBOutlet id currentInput; had to be IBOutlet UITextField *currentInput;
     

Share This Page