objective c - Obj C - Creating Unique Property List Keys using 'For' -


for (int x = 0; x < openslots; x++) {     nsnumber* slotvaluesave = [[nsnumber alloc] initwithint:[[slotvalues objectatindex:x] intvalue]];     nslog(@"saving slot %@.", (x+1));     [valuesavesdictionary setobject:slotvaluesave forkey:@"slot value %i", (x+1)]; } 

hello, i'm trying saving 9 string , corresponding numbers property list key. don't want write out every key @"slot value 1", @"slot value 2", etc.

so wondering how have 'for' statement insert 'x' integer after every title saved under key.

thank you.

use +stringwithformat::

[valuesavesdictionary setobject:slotvaluesave forkey:[nsstring stringwithformat:@"slot value %i", (x+1)]]; 

Comments

Popular posts from this blog

delphi - How to convert bitmaps to video? -

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -