Display String and number together in tableview
I am trying to concatenate and di开发者_StackOverflowsplay string and number together in a table view cell. Is there any mechanism to convert both of them together to a label string?
You could use NSString * compositeString = [[NSString alloc] initWithFormat:@"%@ %d", myOtherString, myInt]
This is described in NSString stringWithFormat:
in the NSString documentation.
Try cell.textLabel.text = [NSString stringWithFormat:@"%@: @d",strIntName, [num intValue]];
cell.textLable.text=[NSString stringWithFormat:@"%@%d",yourString,yourNumber];
精彩评论