网络图片浏览
使用步骤
NSMutableArray *photos = [NSMutableArray array];
for (int i=0; i<self.imageViews.count; i++) {
UIImageView *child = self.imageViews[i];
//1.创建photo模型
JLPhoto *photo = [[JLPhoto alloc] init];
//2.原始imageView
photo.sourceImageView = child;
//3.要放大图片的url
photo.bigImgUrl = self.bigImgUrls[i];
//标志
photo.tag = i;
[photos addObject:photo];
}
//1.创建图片浏览器
JLPhotoBrowser *photoBrowser = [[JLPhotoBrowser alloc] init];
//2.获取photo数组
photoBrowser.photos = photos;
//3.当前要显示的图片
photoBrowser.currentIndex = (int)tap.view.tag;
[photoBrowser show];


本地相册访问
使用步骤
- 检查相册权限,创建相册导航控制器
//1.检查相册权限
[[JLAssetsLibrary shareAssetsLibrary] checkAuthorizationStatus:^(BOOL isAuthorized) {
if (isAuthorized) {//允许访问相册
//2.生成相册控制器
JLNavigationController *nav = [JLNavigationController navigationAlbumControllerWithDelegate:self];
[self presentViewController:nav animated:YES completion:NULL];
}else{//不允许访问
UIAlertView *alerView = [[UIAlertView alloc] initWithTitle:@"未能取得相册访问权限" message:nil delegate:nil cancelButtonTitle:@"我知道了" otherButtonTitles: nil];
[alerView show];
}
}];
- 实现代理,获取返回到图片数组
#pragma mark - JLReturnImageDelegate
/**
返回选中的图片二进制数组
@param imageDatas 图片数组
*/
- (void)returnImageDatas:(NSArray *)imageDatas{
//上传等操作
}


点击下载源代码
网友评论