我有一个名为“test123”的ViewController,我有一个带有按钮的UIWebView:
<button onclick='myFunction()'>Open test123</button>
</body>
<script>
function myFunction()
{
presentViewController('test');
}
</script>
我尝试了this,但我得到了Use of undeclared type 'test123'
func webView(webView: UIWebView, shouldStartLoadWithRequest request: NSURLRequest, navigationType: UIWebViewNavigationType) -> Bool {
if (navigationType == UIWebViewNavigationType.formSubmitted) {
let VC = self.storyboard?.instantiateViewControllerWithIdentifier("test123") as? test123
let navigationController = UINavigationController(rootViewController: VC!)
self.navigationController?.presentViewController(navigationController, animated: true, completion:nil)
}
return true
}
那么我做错了什么?
答案 0 :(得分:0)
您应该将尝试向下转换对象的as? test123
部分移除到显然不存在的类型test123
。