使用Yalantis / Koloda库加载超过1个UIView [英] using Yalantis/Koloda library to load more than just 1 UIView

查看:338
本文介绍了使用Yalantis / Koloda库加载超过1个UIView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我使用这个图书馆,在提供的示例中,只有静态图像用于加载每张卡。但是我想定制每张卡的外观和感觉,包括标签,多重UImage等,我将从parse.com加载。我怎样才能做到这一点。函数
func kolodaViewForCardAtIndex(koloda:KolodaView,index:UInt) - > UIView {



}

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

解决方案

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

$ $ p $ 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!

}


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.

解决方案

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!

}

这篇关于使用Yalantis / Koloda库加载超过1个UIView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆