Swift - 在其它类获取Appdelegate单例的属性或对

2017-09-20  本文已影响0人  麦志超

1. 获取Appdelegate

let myAppdelegate = UIApplication.shared.delegate as! AppDelegate

2. 获取Appdelegate的属性

if myAppdelegate.xx != nil 
{
     xx = myAppdelegate.xx
}
上一篇 下一篇

猜你喜欢

热点阅读