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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -