![報錯資訊](https://i.iter01.com/images/02c7d09b79d4e9c68a7474096f228f6c03fe3875a6eaacf0640614b0f32f73c3.jpg)
Swift是不允許設定協議的可選的狀態,協議宣告的方法都是必須實現的。
解決方案一
![@objc](https://i.iter01.com/images/7cf5b3f4c02a82648978f45bd52b47eaa5f4e6aa8ceafeb0dfec114b57ace8c0.jpg)
解決方案二
實現所有宣告的方法
我的做法
在父類中實現宣告的方法
class HLBaseViewController: UIViewController, UIViewCollectEventsDelegate
func uiView(ClickRefreshWithParams params: AnyObject?) {
}
func uiView(uiView: UIView?, CollectEventsType type: AnyObject?, withParams params: AnyObject?) {
}
複製程式碼
在子類中替換掉要實現的方法
class HomeViewController: HLBaseViewController
override func uiView(uiView: UIView?, CollectEventsType type: AnyObject?, withParams params: AnyObject?) {
NSLog("789")
}
複製程式碼