我正在尝试在Swift应用程序中使用JawBone / JBChartView图表
在我的ViewController中,我有:

class ViewController: UIViewController , JBBarChartViewDelegate {
...
}

我已经实现了符合协议的方法:
override func heightForBarViewAtIndex (bc: JBBarChartView , index: Int) -> Double{
    //return 1;
}

JBarChartViewDelegate是一个ObjectiveC类,因此要实现的原始方法是:
- (CGFloat)barChartView:(JBBarChartView *)barChartView heightForBarViewAtIndex:(NSUInteger)index;

我无法编译得到“ViewController不符合协议JBBarChartViewDelegate”的代码

我做错了什么?

提前致谢。

最佳答案

最后问题是Int参数,它必须是Uint。因此,最终实现的方法是:

func barChartView(barChartView: JBBarChartView!, heightForBarViewAtIndex index: UInt) -> CGFloat{
    return 0.0
}

谢谢大家。

关于ios - Swift- objective-c -“ Controller ”不符合协议(protocol)JBBarChartViewDelegate,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/26108790/

10-11 19:48