Print

根据MJPhotoBrower库修改毕业设计完善而来的图片浏览器

设计辅导Qq:1052602713


2016-12-15 15:03 上传

点击文件名下载附件
图片浏览器

根据MJPhotoBrower库修改而来的图片浏览器,原MJPhotoBrower库已经不更新, 有闪退,开题报告,转圈显示错误等bug,在最新的ios版本里运行还有其他错误。我把这个库里的东西改了一下,修复了这类bug,下载图片,打开,动画等都流畅没问题了。

使用方法:
在h文件里 :

import 'MJPhotoBrowser.h' import 'MJPhoto.h' //图片浏览器相关 0911 MJPhotoBrowser *photoBrowser; BOOL isBrowserShow; NSMutableArray *mjPhotos; int selectIndex; 在m文件里: // 图片数据 mjPhotos = [[NSMutableArray alloc]initWithCapacity:0]; // 显示相册 photoBrowser = [[MJPhotoBrowser alloc] init]; photoBrowser.delegate=self; isBrowserShow=NO; selectIndex=0; //初始化mjPhotos,把图片装进MJPhotoBrowser里 for(int i=0;i<ImgList.count;i++){ NSString *portrait=[[ImgList objectAtIndex:i]objectForKey:@'imgurl'];; MJPhoto *photo = [[MJPhoto alloc] init]; photo.y=0; photo.url = [NSURL URLWithString:portrait]; [mjPhotos addObject:photo]; } //打开图片浏览器,开题报告,显示大图 -(IBAction)showPhotoBrowser:(id)sender{ photoBrowser=[[MJPhotoBrowser alloc]init]; photoBrowser.photos=mjPhotos; photoBrowser.currentPhotoIndex=selectIndex; for(int i=0;i<mjPhotos.count;i++){ MJPhoto *photo=[mjPhotos objectAtIndex:i]; photo.y=0; //位移可变 } [photoBrowser show]; }