基于Photos框架,一句话搞定图片获取; demo地址
IMG_4002.GIF IMG_4006.GIF主要方法
//拍照获取图片
- (void)rf_PhotoWithTakePhoto_targetVC:(UIViewController *)targetVC callBack:(RFPhotoManagerCallBack)callBack;
//相册获取图片
- (void)rf_PhotoWithAlbum_targetVC:(UIViewController *)targetVC callBack:(RFPhotoManagerCallBack)callBack;
使用
拍照
- (void)takePhoto:(UIBarButtonItem *)item {
__weak __typeof(self)weakSelf = self;
[[RFPhotoManager sharedInstance] rf_PhotoWithTakePhoto_targetVC:self callBack:^(NSArray * _Nonnull photos) {
__strong __typeof(weakSelf)strongSelf = weakSelf;
[strongSelf setTextViewWithPhotos:photos];
}];
}
相册
-(void)enterPhotoAlbum:(UIBarButtonItem *)item{
__weak __typeof(self)weakSelf = self;
[[RFPhotoManager sharedInstance] rf_PhotoWithAlbum_targetVC:self callBack:^(NSArray * _Nonnull photos) {
__strong __typeof(weakSelf)strongSelf = weakSelf;
[strongSelf setTextViewWithPhotos:photos];
}];
}
如果这篇文章对您有用,烦请点个赞,谢谢
网友评论