Jason
Jason

Reputation: 650

UILabel initial text not showing when connecting as a IBOutlet

So I have a UILabel connected as an IBOutlet. It's initial text shows up if the label is not connected in IB, but as soon as I do connect it, the initial text doesn't show up until after I have ran my IBAction which changes the text to something else. For example:

I want it to show "Enter total" when the view loads, and after the IBAction runs it will change to a number. I've tried..

myLabel.text = @"Enter total";

At the Viewdidload method. I've also tried...

myLabel.hidden = NO;

It is setup in IB with the correct initial title as well. Nothing will show the initial text without disconnecting the IBOutlet in IB. I know I'm missing something...please help!

in my .h

IBOutlet UILabel *myLabel;
@property (nonatomic, retain) IBOutlet UILabel *myLabel;

In my xib the title for the label is "Enter total"

Upvotes: 1

Views: 652

Answers (1)

Wasif Saood
Wasif Saood

Reputation: 2008

1) In your nib click on label where you want to show text

2) Then click on top bar view in text write your text @"Enter total";

3) compile and run u'll see it as a default text.

Upvotes: 1

Related Questions