可以包含 UIImage、图片 URL 或任何视图的轮播视图
import OmniCarouselView
OmniCarouselView
let images = [UIImage(named: "beer1"), UIImage(named: "beer2"), UIImage(named: "beer3")]
carouselView1.contents = images
.filter({$0 != nil})
.map({OmniCarouselView.Content.Image($0!)})
let imageUrls = Array(1...3).map({i in NSURL(string: "https://raw.githubusercontent.com/nakaji-dayo/OmniCarouselView/master/Example/OmniCarouselView/Images.xcassets/beer\(i).imageset/beer\(i).jpeg")})
carouselView2.contents = imageUrls.filter({$0 != nil}).map({OmniCarouselView.Content.ImageUrl($0!)})
let labels = Array(0..<3).map { (i) -> UILabel in
let label = UILabel()
label.text = "label:\(i)"
return label
}
carouselView3.contents = labels.map({OmniCarouselView.Content.View($0)})
OmniCarouselView 通过 CocoaPods 提供。要安装,只需将以下行添加到您的 Podfile 中
pod "OmniCarouselView"
key | type | description |
---|---|---|
infinite | Bool | 使用无限循环翻页(滚动) |
pager | Bool | 显示页面指示器 |
nakaji-dayo, [email protected]
OmniCarouselView 在 MIT 许可下提供。有关更多信息,请参阅 LICENSE 文件。