美文网首页
UIApplication

UIApplication

作者: ShawnDu | 来源:发表于2016-01-23 16:32 被阅读35次
  • Swift 中没有了main函数,但是在app delegate中有@UIApplicationMain, 可以去它,手动建一个main.swift文件:
import UIKit

class MyApplication: UIApplication {
    override func sendEvent(event: UIEvent) {
        super.sendEvent(event)
        print("Event sent: \(event)");
    }
}

UIApplicationMain(Process.argc, Process.unsafeArgv, NSStringFromClass(MyApplication), NSStringFromClass(AppDelegate))

这样写,当在程序运行过程中,每次发送事件,都能监听得到。

相关文章

网友评论

      本文标题:UIApplication

      本文链接:https://www.haomeiwen.com/subject/kqsrkttx.html