ios - How to convert a Number to NSString in Objective-C -


i have price parameter api price: 10 want show in textfield appending "$" after it. doesn't show number anyway casting it. here code :

cell.price.text = [[nsstring stringwithformat:@"%i", (nsnumber*)dic[@"items"][indexpath.row][@"price"]]  stringbyappendingstring:@" $"]; 

to print nsnumber need use %@ instead of %i

cell.price.text = [nsstring stringwithformat:@"%@ $", (nsnumber*)dic[@"items"][indexpath.row][@"price"]]; 

Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -