I want to know how to take an array of images by using UIImagePickerController
and also post an array to the server and as well as get this an array of images from server by using JSON web services. And also I need to post image information (date of taking) to server.
I am getting image by using UIImagePickerController . Here is my code
-(IBAction)fileselectionAction:(id)sender{
[self.view endEditing:YES];
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:@"Pick Photo From" delegate:self cancelButtonTitle:nil destructiveButtonTitle:nil otherButtonTitles:@"Photo Album", @"Take New Photo", @"Cancel", nil];
[actionSheet showFromToolbar:self.navigationController.toolbar];
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
self.imagePickerController = [[UIImagePickerController alloc] init];
self.imagePickerController.delegate = self;
if (buttonIndex == 0) {
//[self.imagePickerController setAllowsEditing:YES];
self.imagePickerController.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
self.imagePickerController.allowsEditing = YES;
[self presentViewController:self.imagePickerController animated:YES completion:nil];
} else if (buttonIndex == 1) {
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
self.imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
[self.imagePickerController setAllowsEditing:YES];
//self.imagePickerController.showsCameraControls = YES;
[self presentViewController:self.imagePickerController animated:YES completion:nil];
}
}
}
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingImage:(UIImage *)image
editingInfo:(NSDictionary *)info
{
[picker dismissViewControllerAnimated:YES completion:nil];
picker = nil;
NSData *imageData = UIImageJPEGRepresentation(image,0.0);
self.image1 = [UIImage imageWithData:imageData];
}
Thanks in advance.