Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NSString stringWithFormat

I don't know what I am missing here. I am trying to concatenate strings using [NSString stringWithFormat] function. This is what I am doing.

NSString *category = [row objectForKey:@"category"];
NSString *logonUser = [row objectForKey:@"username"];
user.text = [NSString stringWithFormat:@"In %@ by %@", category, logonUser];

The problem here is that it always print only one variable. Say if there is "Sports" in category and "Leo" in logonUser it will print "In Sports" and skip the remaining text. It should print "In Sports by Leo".

like image 500
Leo Avatar asked Apr 29 '10 19:04

Leo


2 Answers

Is user a UILabel? Make sure that your text isn't wrapping or being clipped. Try making the UILabel bigger.

like image 70
lucius Avatar answered Oct 18 '22 08:10

lucius


You need to try:

NSLog(@"In %@ by %@", category, logonUser);

To check the problem! Let me know the results on debugger console XD

like image 36
Ivan Carosati Avatar answered Oct 18 '22 08:10

Ivan Carosati