Reputation: 20
I am creating some pictures in the "Pictures" directory. I would like to increment the name of each picture added by 1... Untitled 001, Untitled 002, Untitled 003 etc
I am trying it like this. Every time I create the picture, myPicNumber increments like so:
myPicNumber = myPicNumber + 1;
NSString* string = NSHomeDirectory();
NSString* pth1 = [string stringByAppendingPathComponent:@"/Pictures/Untitled.png"];
How do I code this @"/Pictures/Untitled.png"]; to do the incrementation?
Thanks in advance
Upvotes: 0
Views: 42
Reputation: 11201
Try this:
[NSString stringWithFormat:@"/Pictures/Untitled%d.png", myPicNumber];
Upvotes: 1