使用Yalantis / Koloda库加载不止1个UIView

所以我正在使用这个库,并且在提供的例子中,只有静态图像被用来加载到每个卡。 但是我想定制每张卡的外观和感觉,标签,多重UImages等,我将加载从parse.com。 我怎样才能做到这一点。 函数func kolodaViewForCardAtIndex(koloda:KolodaView,index:UInt) – > UIView {

}

只返回UIview。 有什么build议么。

我已经完成了以下工作。 创build一个自定义的接口(.xib)视图和类(在我的例子中称为“CustomView”)

func koloda(kolodaNumberOfCards koloda:KolodaView) -> UInt { return UInt(self.run.count) } func koloda(koloda: KolodaView, viewForCardAtIndex index: UInt) -> UIView { let cell = NSBundle.mainBundle().loadNibNamed("CustomView", owner: self, options: nil).first as? CustomView let runs = self.run[Int(index)] cell!.textLabel!.text = runs.type return cell! } 

数据源方法

  func kolodaViewForCardAtIndex(koloda: KolodaView, index: UInt) -> UIView 

接受任何UIView。 所以只需要创build你需要的视图(例如从xib)并用这个方法返回。