Swift获取到AppDelegate

前端之家收集整理的这篇文章主要介绍了Swift获取到AppDelegate前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

// 拿到 AppDelegate

let tempAppDelegate = UIApplication .sharedApplication().delegate;

tempAppDelegate!.window!!.rootViewController = XNMainController();

// 拿到 AppDelegate
let tempAppDelegate = UIApplication .sharedApplication().delegate as! AppDelegate;


OC

// 拿到 AppDelegate AppDelegate *tempAppDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate]; XNViewController *vc = [[XNViewController alloc]init]; tempAppDelegate.window.rootViewController = vc;

原文链接:https://www.f2er.com/swift/323890.html

猜你在找的Swift相关文章