QUImageViewController
这是一个功能齐全的 iOS 图片查看器:双击缩放,轻扫取消,等等。
拉取请求
欢迎提交拉取请求,但应提交到 dev
分支。对于关键错误修复将例外。
它做什么?
QUImageViewController 像是 iOS 的“相册”,它与您可能在微博、Tweetbot等应用中见到的图片查看器相似。它在全屏交互视图中展示图片。用户可以滚动缩放,甚至可以使用 Tweetbot 风格的动态手势通过一个愉快的轻扫来关闭它。
截图
它如何工作?
使用方法很简单,尽管还有一些漂亮的选项和代理方法,如果您需要的话。下面是最简单的实现例子
- (void)someBigImageButtonTapped:(id)sender {
// Create image info
QUImageInfo *imageInfo = [[QUImageInfo alloc] init];
imageInfo.image = YOUR_SOURCE_IMAGE;
imageInfo.referenceRect = self.bigImageButton.frame;
imageInfo.referenceView = self.bigImageButton.superview;
// Setup view controller
QUImageViewController *imageViewer = [[QUImageViewController alloc]
initWithImageInfo:imageInfo
mode:QUImageViewControllerMode_Image
backgroundStyle:QUImageViewControllerBackgroundOption_Scaled];
// Present the view controller.
[imageViewer showFromViewController:self transition:QUImageViewControllerTransition_FromOriginalPosition];
}
就是这样。
附加选项
-
图片下载:如果您还没有源图片,只需在设置
QUImageInfo
实例时使用imageURL
属性。QUImageViewController 将为您处理图片下载。 -
背景样式:选择缩放并暗淡的样式或缩放、暗淡和模糊的背景样式。后者类似于 Tweetbot 中使用的样式。
-
ALT 文本模式:需要显示图片的ALT文本?QUImageViewController 提供了一个替代模式,该模式使用与图片模式相同的方式来显示全屏居中的文本视图。
-
处理长按:实现
interactionsDelegate
来响应图片上的长按,或暂时禁用用户交互(如果您显示可能会引起手势冲突的覆盖层,这将非常有用)。
许可证
MIT 许可证,请参阅所附文件。