MomentsGallery 0.1.3

MomentsGallery 0.1.3

测试已测试
Lang语言 SwiftSwift
许可 MIT
发布最后发布2016年4月
SPM支持 SPM

Melvin Beemer 维护。




MomentsGallery

MomentsGallery 是一个受 Twitter Moments 启发的画廊视图控制器。在翻动照片时具有视差效果,可点击查看全图,并具有添加标题和副标题的功能。

MomentsGallery Exmaple

用法

要运行示例项目,请克隆仓库,并首先从示例目录运行 pod install

本地图片

var images = ["1.jpg", "2.jpg", "3.jpg"]
var moments: [Moment] = []

for imagePath in images {
    let moment = Moment(image: UIImage(named: imagePath))
    moments.append(moment)
}

let momentsVC = MomentsGallery(moments: moments)
self.presentViewController(momentsVC, animated: true, completion: nil)

网络图片

var images = ["http://url.com/1.jpg", "http://url.com/2.jpg", "http://url.com/3.jpg"]
var moments: [Moment] = []

for imageUrl in images {
    let moment = Moment(url: imageUrl)
    moments.append(moment)
}

let momentsVC = MomentsGallery(moments: moments)
self.presentViewController(momentsVC, animated: true, completion: nil)

控制页码索引

let momentsVC = MomentsGallery(moments: [moment, moment, moment])
momentsVC.initialPageIndex = 2 // Set initial index before presenting, not animated
self.presentViewController(momentsVC, animated: true, completion: nil)

momentsVC.scrollToIndex(2) // Set index after view controller is presented, animated

要求

  • Swift 2.1
  • iOS 8.2

依赖

安装

MomentsGallery 可通过 CocoaPods 安装。要安装,请简单地在 Podfile 中添加以下行

pod "MomentsGallery"

作者

Melvin Beemer, [email protected]

许可

MomentsGallery 在 MIT 许可下可用。有关更多信息,请参阅 LICENSE 文件。