我正在构建一个类似抽认卡的应用程序,并且我正在使用库 KolodaView:https ://github.com/Yalantis/Koloda
我有这个扩展,它返回 aUIView
作为抽认卡的前面:
extension StudyViewController: KolodaViewDataSource {
func kolodaNumberOfCards(koloda:KolodaView) -> UInt {
return UInt(memories.count)
}
func koloda(koloda: KolodaView, viewForCardAtIndex index: UInt) -> UIView {
return UIImageView(image: memories[Int(index)].frontImage)
}
func koloda(koloda: KolodaView, viewForCardOverlayAtIndex index: UInt) -> OverlayView? {
return NSBundle.mainBundle().loadNibNamed("OverlayView",owner: self, options: nil)[0] as? OverlayView
}
}
我希望能够通过点击将视图转换为后视图:
func koloda(koloda: KolodaView, didSelectCardAtIndex index: UInt) {
let frontView: UIView = koloda as KolodaView
let backView: UIView = UIImageView(image: memories[Int(index)].backImage)
if showingFront == true {
UIView.transitionFromView(frontView, toView: backView, duration: 1, options: UIViewAnimationOptions.TransitionCrossDissolve, completion: nil)
} else {
UIView.transitionFromView(backView, toView: frontView, duration: 1, options: UIViewAnimationOptions.TransitionCrossDissolve, completion: nil)
showingFront = false
}
}
过渡成功,但完成后,抽认卡会从aKolodaView
变成giantUIView
我如何将 a 转化KolodaView
为花药KolodaView
?