Getting value of the textfield

Discussion in 'iOS Programming' started by Binju, May 17, 2010.

  1. Binju macrumors member

    Joined:
    Jan 31, 2010
    #1
    I want to get the value of a textfield and want to compare with the string.

    I used the below code

    username =@"test";


    Code:
    if ( [txtusername text]  == username)
    
    {
    
      NSLog(@"Equal");
    
    }
    The above code is not working eventhough I entered the "test" in the txtusername.
     
  2. ChOas macrumors regular

    Joined:
    Nov 24, 2006
    Location:
    The Netherlands
    #2
    Documentation

    Code:
    if ([[txtusername stringValue] isEqualToString:username] == YES) {
    
    };
    
     
  3. Binju thread starter macrumors member

    Joined:
    Jan 31, 2010
    #3
    Code:
    NSLog(@"Textbox Username=%@",[txtusername stringValue]);
    gives null value
     
  4. TiberiusXavier macrumors member

    Joined:
    Apr 18, 2010
    Location:
    Chicago
    #4
    Have you tried:
    Code:
    if ( [[txtusername text]  isEqualToString: username] == YES )
    {
      NSLog(@"Equal");
    }
    
     
  5. firewood macrumors 604

    Joined:
    Jul 29, 2003
    Location:
    Silicon Valley
    #5
    The variable "username" is a pointer to an opaque data type.
    Do you know what a pointer is?
     

Share This Page