Assigning an NSString value to a UI label character

I am trying to assign the value of an NSString object to the UILabel.text property like this:

lblCalories.text = [NSString stringWithFormat:@"%@", _pickData[row]];

      

and yes, the _pickData [string] value - everything is fine - made sure it did, but somehow lblCalories just displays as null.

Please, help!

+3


source to share


1 answer


Based on your comment, I believe this is your problem.

The UILabel property should be configured like this:

@property (weak, nonatomic) IBOutlet UILabel *lblCalories;

      



Then you need to wire this to the actual UILabel in the Interface Builder. After that, you can set the text using:

self.lblCalories.text = [NSString stringWithFormat:@"%@", self.pickData[row]];

      

Also just side note, better to use self.property

instead_property

+1


source







All Articles