可以在运行时更改AppDelegate [英] Possible to change AppDelegate at runtime

查看:95
本文介绍了可以在运行时更改AppDelegate的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在运行时将UIApplication.delegate属性更改为另一个实现UIApplicationDelegate协议的类,以便从那时起在新类上调用UIApplicationDelegate函数?

Is it possible to change the UIApplication.delegate property at runtime to another class that implements the UIApplicationDelegate protocol so that from then on UIApplicationDelegate functions are called on the new class?

推荐答案

您可以非常简单地使用 [UIApplication sharedApplication] .delegate = instanceOfDifferentClass 进行更改。

You can very simply change it with [UIApplication sharedApplication].delegate = instanceOfDifferentClass.

这篇关于可以在运行时更改AppDelegate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆