问题
So I'm using this library and in the example provided only static images are used to load into each card. however I want to customize the look and feel of the each card with labels, multiples UImages etc that i will load from parse.com . How can I achieve this. the function func kolodaViewForCardAtIndex(koloda: KolodaView, index: UInt) -> UIView {
}
Only return UIview. Any suggestions.
回答1:
I've done the following and it works. Create a custom interface (.xib) view and class (in my example its called "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!
}
回答2:
Data source method
func kolodaViewForCardAtIndex(koloda: KolodaView, index: UInt) -> UIView
Takes any UIView. So just create the view you need(for example from xib) and return it in this method.
来源:https://stackoverflow.com/questions/32111556/using-yalantis-koloda-library-to-load-more-than-just-1-uiview