我试图将navigationController推送到另一个视图,我收到此错误“无法将类型'WeatherViewController'的值转换为预期的参数类型'UIViewController'”
extension RegionListViewController: SidebarViewDelegate {
func sidebarDidSelectRow(row: Row) {
blackScreen.isHidden = true
blackScreen.frame = self.view.bounds
UIView.animate(withDuration: 0.3) {
self.sidebarView.frame=CGRect(x: 0, y: 0, width: 0, height: self.sidebarView.frame.height)
}
switch row {
case .ethiopia:
let vc = EthiopiaVC()
self.navigationController?.pushViewController(vc, animated: true)
case .weather:
let wV = WeatherViewController()
self.navigationController?.pushViewController(wV, animated: true)
case .currency:
print("Settings")
case .Searchs:
let sv = SearchViewController()
**self.navigationController?.pushViewController(sv, animated: true)** error here
case .feedbacks:
print("Sign out")
case .none:
break
}
}
}
确保您的自定义视图控制器都是UIViewController
的子类。