iOS 自定义View 中跳转UIViewController
自定义View中实现控制器的跳转,可以有多种实现方式:
1 使用Notification
使用Notification,在父控制器打开需要跳转的控制器
2 使用代理
使用代理通知父控制器跳转
3 使用闭包
原理同第2条
4 使用主窗口的根控制器
拿到主窗口的根控制器,用根控制器打开需要跳转的控制器
Swift
let nav = UIApplication.shared.keyWindow?.rootViewController as! UIViewController
let feedVC = FeedBackViewController.init()
nav.present(feedVC!, animated: true, completion: nil)
OC
UIViewController