SAVE IMAGE N DOCUMENTDIRECTORY NUMBER WISE

LIKE:-

J1.png

J2.png

/////////////

 

.h

int nImageCount;

.m

– (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {

nImageCount = nImageCount +1;

UIImage *pickedImage = [info objectForKey:UIImagePickerControllerEditedImage];

NSData *data=UIImagePNGRepresentation(pickedImage);

NSString *FileName=[NSString stringWithFormat:@”J%d.png”, nImageCount];

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);

NSString *documentsDirectory = [paths objectAtIndex:0];

NSString *tempPath = [documentsDirectory stringByAppendingPathComponent:FileName];

[data writeToFile:tempPath atomically:YES];

[picker dismissViewControllerAnimated:YES completion:nil];

 

 

}

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s