2015-07-20 54 views
0

我試圖通過陣列設置UIButton文本像這樣:標題標籤未示出的UIButton

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

但是沒有文字上的應用程序出現在加載時。文本正在返回並存儲在數組中。這裏是我的按鈕進行定製:

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

回答

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

我想你已經得到了回答你的問題。然而,如果你正在尋找不同的東西,試試這個:is it possible to update UIButton title/text programmatically?

+0

而不是回答一個鏈接,你應該嘗試引用這個答案的主要部分。例如。 「你有沒有嘗試鏈接」*引用鏈接部分最好的回答這裏的問題* – Tas