1. 使用 Storyboard 或 Xib 设置 2. 设置 imageArray 属性,可以使用 UIImage 或 URL 字符串
let imageArray = [
UIImage(named: "bamboo")!,
UIImage(named: "plum blossom")!,
UIImage(named: "lotus")!
]
carouse.imageArray = imageArray
let urlArray = [
"http://d.lanrentuku.com/down/png/1307/jiqiren-wall-e/jiqiren-wall-e-04.png",
"http://d.lanrentuku.com/down/png/1307/jiqiren-wall-e/jiqiren-wall-e-05.png",
"http://d.lanrentuku.com/down/png/1307/jiqiren-wall-e/jiqiren-wall-e-03.png"
]
let carouse = MinCarouseView(frame: aFrame, imageArray: urlArray)
self.view.addSubview(carouse)
tapClosure:点击 imageView 时回调
carouse.tapClosure = { index in
// do something
}
这就完了