Although it's very simple, most developers new to the iPhone SDK wonders how to change the UIButton text with Xcode and not just in interface builder.
Well, I will show you how below.
In your header file create an instance of UIButton.
@property(nonatomic,retain)IBOutlet UIButton *button1;
Next, go to your implementation file.
@synthesize button1;
With the viewDidLoad method the text can be changed with the following code:
[button setTitle:@"About Us" forState:UIControlStateNormal];
I hope this helps. Have a great weekend!
If you get a chance, please check out my car app for iPhone in the iTunes App Store.
No comments:
Post a Comment