Prad
Prad

Reputation: 469

Title Label not showing for UIButton

I am attempting to set a UIButton Text through an array like so:

// Set User Name
NSString *user = entry[@"user"][@"full_name"];
[cell.nameLabel.titleLabel setText:user];

However no text appears on the Application when it loads. The text is being returned and it is stored in the array. Here is my customization of the Button:

// Name
self.nameLabel = [[UIButton alloc] initWithFrame:CGRectMake(58, 6, 192, 25)];
[self.nameLabel.titleLabel setFont:[UIFont fontWithName:@"Helvetica-Regular" size:12.0]];
self.nameLabel.titleLabel.textColor = [UIColor colorWithRed:(38.0/255.0) green:(120.0/255.0) blue:(172.0/255.0) alpha:1.0];
[self.contentView addSubview:self.nameLabel];

Upvotes: 0

Views: 157

Answers (1)

HorseT
HorseT

Reputation: 6592

[self.nameLabel setTitle:user forState:UIControlStateNormal];

Upvotes: 1

Related Questions