IOS获取系统相册图片
2017-05-17 23:12
387 查看
获取系统相册图片,首先遵守代理协议
添加点击事件
选择图片后 要做的事 实现在代理方法中
接下来一起去看下效果吧!
看完单选图片,一起看一下更常用的多选系统相册图片吧:
http://blog.csdn.net/lee727n/article/details/72455769
@interface ViewController ()<UINavigationControllerDelegate, UIImagePickerControllerDelegate> @end
添加点击事件
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event { UIImagePickerController *vc = [UIImagePickerController new]; //有三种 照相机 文件夹 相册 // vc.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; vc.delegate = self; vc.allowsEditing = YES; [self presentViewController:vc animated:YES completion:nil]; }
选择图片后 要做的事 实现在代理方法中
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info{ NSLog(@"%@",info); UIImage *image= info[@"UIImagePickerControllerEditedImage"]; UIImageView *iv = [[UIImageView alloc]initWithFrame:CGRectMake(100, 100, 200, 200)]; iv.image = image; [self.view addSubview:iv]; [self dismissViewControllerAnimated:YES completion:nil]; }
接下来一起去看下效果吧!
看完单选图片,一起看一下更常用的多选系统相册图片吧:
http://blog.csdn.net/lee727n/article/details/72455769
相关文章推荐
- iOS开发之获取系统相册中的图片与视频(内带url转换)
- iOS开发swift如何调用系统相册和相机获取图片设置用户头像
- iOS获取系统相册中的图片
- iOS开发 获取系统相册最后一张图片 、 截屏广播
- iOS图片处理(一)————调用系统相机和相册获取图片,给相机添加自定义覆盖物
- iOS-获取系统的相册图片
- iOS开发之获取系统相册中的图片与视频(内带url转换)
- iOS 系统相册获取图片,保存图片,以及剪切图片
- iOS开发之获取系统相册中的图片与视频(内带url转换)
- iOS开发之获取系统相册中的图片与视频(内带url转换)
- iOS中获取系统相册中的图片
- iOS开发之获取系统相册中的图片与视频(内带url转换)
- ios学习--获取通过UIImagePackerController获取的系统相册 图片&视频 的名称信息
- iOS图片处理(一)调用系统相机和相册获取图片,给相机添加自定义覆盖物
- ios读取系统相册以及获取图片的名字
- iOS开发之获取系统相册中的图片与视频(内带url转换)
- iOS中获取系统相册中的图片
- iOS中获取系统相册中的图片实例
- iOS中获取系统相册中的图片
- iOS开发之获取系统相册中的图片与视频(内带url转换)