开发者

Text not being displayed correctly due to code formatted wrong maybe?

开发者 https://www.devze.com 2023-02-05 04:44 出处:网络
I have NSMutableDictionary that I\'m retrieving text from. I\"m trying to display this text into a tableview cell along with some other text that I want added with it. Here\'s my non-working code:

I have NSMutableDictionary that I'm retrieving text from. I"m trying to display this text into a tableview cell along with some other text that I want added with it. Here's my non-working code:

[[cell name] setText:(@"Name:%@",[NameDict valueForKey:@"name"])];

I've even tried stringWithFormat and still can't get it to work. I can't get the Name: part to display into the cell along with NameDict value for that key. 开发者_如何学运维Any ideas what I'm doing wrong here? Thanks.


I'm not sure where you are getting [cell name] from, but this would be a better solution for you based on your code:

[[cell name] setText:[NSString stringWithFormat:@"Name:%@",[NameDict objectForKey:@"name"]]];

If you are trying to place that text as the cell text, use:

cell.textLabel.text = [NSString stringWithFormat:@"Name:%@",[NameDict objectForKey:@"name"]];
0

精彩评论

暂无评论...
验证码 换一张
取 消