我正在使用图书馆KolodaView:https://github.com/Yalantis/Koloda
尝试为dataSource
StudyViewController
方法时出错
以下是代码:
import UIKit
import Koloda
class StudyViewController: UIViewController {
@IBOutlet weak var kolodaView: KolodaView!
override func viewDidLoad() {
super.viewDidLoad()
kolodaView.dataSource = self // Error here
kolodaView.delegate = self
}
}
extension StudyViewController: KolodaViewDelegate {
}
extension StudyViewController: KolodaViewDataSource {
func kolodaNumberOfCards(koloda:KolodaView) -> UInt {
return UInt(5)
}
func koloda(koloda: KolodaView, viewForCardAtIndex index: UInt) -> UIView {
return UIImageView(image: UIImage(named: "Image"))
}
func koloda(koloda: KolodaView, viewForCardOverlayAtIndex index: UInt) -> OverlayView? {
print(NSBundle.mainBundle().loadNibNamed("OverlayView",
owner: self, options: nil)[0])
return NSBundle.mainBundle().loadNibNamed("OverlayView",owner: self, options: nil)[0] as? OverlayView
}
}
错误消息为:线程1:EXC_BAD_ACCESS