enjoysr / espicturebrowser Goto Github PK
View Code? Open in Web Editor NEW一个集成简单交互效果不错的图片浏览器😄
License: MIT License
一个集成简单交互效果不错的图片浏览器😄
License: MIT License
支持横屏+1
此方法在大多数情况下可用,但当加载的是网络图片时无法预知大小导致不能正确显示。个人建议加载完后再根据图片大小自行设置。
非常赞,可以支持横屏么?
两只手指或者点击两次放大后,不可向右拖动
您好!第一次点击小图弹出正常,点击图片dismiss之后再次点击小图,小图也会出现在屏幕上,点击大图使其dismiss没有了动画效果。
代码如下:
`_taskImgThumbnail = [[UIImageView alloc] init];
//先截取原图正方形图片,再转化为200宽缩略图,转化为50的话图片模糊
_taskImgThumbnail.image = [self thumbnailWithImage:[self thumbnailCenterImage:[UIImage imageNamed:@"IMG_0065"] centerInSize:CGSizeMake([UIImage imageNamed:@"IMG_0065"].size.width, [UIImage imageNamed:@"IMG_0065"].size.width)] size:CGSizeMake(200,200)];
[self.view addSubview:_taskImgThumbnail];
[_taskImgThumbnail mas_makeConstraints:^(MASConstraintMaker make) {
make.centerX.equalTo(taskImgTip);
make.top.equalTo(taskImgTip.bottom).offset(7WIDTHRATE);
make.size.equalTo(CGSizeMake(50WIDTHRATE, 50WIDTHRATE));
}];
_tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(taskImgTapEvent:)];
_tap.delegate = self;
_taskImgThumbnail.userInteractionEnabled = YES;
[_taskImgThumbnail addGestureRecognizer:_tap];
_picBrowser = [[ESPictureBrowser alloc] init];
_picBrowser.delegate = self;
#pragma mark -- 点击手势触发的事件
#pragma mark - 图片查看
(UIView *)pictureView:(ESPictureBrowser )pictureBrowser viewForIndex:(NSInteger)index {
return _taskImgThumbnail;
}
/
(CGSize)pictureView:(ESPictureBrowser )pictureBrowser imageSizeForIndex:(NSInteger)index {
return CGSizeMake(DEVICEWIDTH, DEVICEHEIGHT);
}/
(UIImage *)pictureView:(ESPictureBrowser *)pictureBrowser defaultImageForIndex:(NSInteger)index {
return [UIImage imageNamed:@"pic01"];
}
(NSString *)pictureView:(ESPictureBrowser *)pictureBrowser highQualityUrlStringForIndex:(NSInteger)index {
return @"https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1490603248787&di=34c3c9dbbfc54f7f004977c5ae716b3e&imgtype=0&src=http%3A%2F%2Fbbs.crsky.com%2F1236983883%2FMon_1208%2F25_187069_d3846bd52f4f0fa.jpg";
}`
浏览图片的时候隐藏状态栏效果更好。有一些图片是手机截屏,浏览时和状态栏重合的,看着很不舒服
目前好像不支持横屏显示!!
你好,代码里面有多处可能产生强引用循环问题。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.