如何在swift中获取UIViewController
个类的类名
在目标C中,我们可以这样做:
self.appDelegate = (shAppDelegate *)[[UIApplication sharedApplication] delegate];
UIViewController *last_screen = self.appDelegate.popScreens.lastObject ;
if(last_screen.class != self.navigationController.visibleViewController.class){
//.......
}
但在Swift ,我试着这样做
let appDelegate = UIApplication.sharedApplication().delegate as AppDelegate
let last_screen = appDelegate.popScreens?.lastObject as UIViewController
我不能这么做.
if last_screen.class != self.navigationController.visibleViewController.class{
//....
}
没有UIViewController
的类方法,即最后一屏