Taken
Taken

Reputation: 27

UITextField Showing (null)

This was working fine and I want to say it changed after I upgraded xcode. Basically I have an IBAction Button for the number 2 when pressed updates a UITextfield. It works, but it is putting (null)before the 2 now for some reason. Example: (null)2

If I hit the clear or delete button and press 2 again it's fine. It's just when it launches the first time.

-(IBAction)button2 {
display.text =[NSString stringWithFormat:@"%@2",display.text];

}

Any ideas? thanks for your time, DK

Upvotes: 1

Views: 268

Answers (1)

Ilario
Ilario

Reputation: 6079

the first time display.text is (null) because there's nothing written

to fix this in viewDidLoad write: display.text = @""

Upvotes: 2

Related Questions