Home > DeveloperSection > Forums > Problem with assigning NSString value into UILabel in iPhone
Lillian Martin

Total Post:27

Posted on    November-24-2015 3:04 AM

 iPhone iPhone  Ios  Objective C 

 1 Reply(s)
 458  View(s)
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.!

Tarun Kumar

Total Post:214

Posted on    November-24-2015 3:17 AM

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]];

Don't want to miss updates? Please click the below button!

Follow MindStick