Created
May 3, 2016 05:11
-
-
Save raghunath44/07db4a2a6139a174759ba0d0fe48d724 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[self openPhotoAlbum]; | |
- (void)openPhotoAlbum | |
{ | |
[[NSOperationQueue mainQueue] addOperationWithBlock:^{ | |
UIImagePickerController *controller = [[UIImagePickerController alloc] init]; | |
controller.delegate = self; | |
controller.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; | |
[self presentViewController:controller animated:YES completion:NULL]; | |
}]; | |
} | |
- (void) imagePickerController: (UIImagePickerController *) picker didFinishPickingMediaWithInfo: (NSDictionary *) info | |
{ | |
NSString * mediaType = info[UIImagePickerControllerMediaType]; | |
NSLog(@"image==>>%@",mediaType); | |
if([mediaType isEqualToString:(__bridge NSString *)kUTTypeImage]) | |
{ | |
NSLog(@"Image"); | |
JSQPhotoMediaItem *photoItem = [[JSQPhotoMediaItem alloc] initWithImage:[UIImage imageNamed:mediaType]]; | |
JSQMessage *photoMessage = [JSQMessage messageWithSenderId:kJSQDemoAvatarIdSquires | |
displayName:kJSQDemoAvatarDisplayNameSquires | |
media:photoItem]; | |
[_messages addObject:photoMessage]; | |
[self dismissViewControllerAnimated:picker completion:nil]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment