Problem with assigning NSString value into UILabel in iPhone

Total Post:27

Points:189
 730  View(s)
Ratings:
Rate this:

I am new in iPhone app development so I have a problem with assigning string value into UILabel.
Code is here:

myLabel.text = [NSString stringWithFormat:@"%@", dataArr[row]];

the value of dataArr[row] is good - but myLabel variable appears as null.
How to solve this issue, please help me.!

  1. Post:214

    Points:1642
    Re: Problem with assigning NSString value into UILabel in iPhone

    I think your myLabel variable property is set like this:

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

    If you are defining property like that then you need to connect this to an actual UILabel in InterfaceBuilder.
    After that you will set the myLabel text using this code:

    self.myLabel.text = [NSString stringWithFormat:@"%@", self.dataArr[row]];

Answer