Ios 使用Swift打开新的UIViewController
使用CoreGraphics,我能够获得单击位置Ios 使用Swift打开新的UIViewController,ios,iphone,swift,events,uiviewcontroller,Ios,Iphone,Swift,Events,Uiviewcontroller,使用CoreGraphics,我能够获得单击位置 我的要求是根据对图像不同区域的单击打开不同的UIViewController。您需要使用以下方法之一根据触摸的位置创建新的UIViewController: 手动创建它 let controller = SubclassViewController() //prepare your view controller here 从故事板实例化控制器 if let controller = storyboard.instantiateViewCon
我的要求是根据对图像不同区域的单击打开不同的
UIViewController
。您需要使用以下方法之一根据触摸的位置创建新的UIViewController
:
let controller = SubclassViewController()
//prepare your view controller here
if let controller = storyboard.instantiateViewControllerWithIdentifier("identifier") as? SubclassViewController {
//prepare your view controller here
}
performSegueWithIdentifier("segueIdentifier")
然后在prepareforsgue:
if let controller = segue.destinationViewController as? SubclassViewController {
//prepare your controller here
}
let controller = SubclassViewController()
//prepare your view controller here