【发布时间】:2014-12-09 02:32:40
【问题描述】:
如何快速获取UIViewController类的类名
在 Objective C 中,我们可以这样做:
self.appDelegate = (shAppDelegate *)[[UIApplication sharedApplication] delegate];
UIViewController *last_screen = self.appDelegate.popScreens.lastObject ;
if(last_screen.class != self.navigationController.visibleViewController.class){
//.......
}
但很快我就这样尝试了
let appDelegate = UIApplication.sharedApplication().delegate as AppDelegate
let last_screen = appDelegate.popScreens?.lastObject as UIViewController
不能这样做。
if last_screen.class != self.navigationController.visibleViewController.class{
//....
}
没有UIViewController 的类方法,即最后一屏
【问题讨论】:
标签: ios objective-c uiviewcontroller swift