applicationDidBecomeActive 后加载视图

发布于 2025-01-08 05:08:01 字数 388 浏览 4 评论 0原文

我想每次应用程序从后台启动时都显示一个 ViewController,我有这样的代码:

mainViewController *mainController = [[mainViewController alloc] init];
UIViewController *src = (UIViewController *) self.window.rootViewController;
UIViewController *dst = (UIViewController *) mainController;
[src presentModalViewController:dst animated:YES];

ViewController 加载,因为键盘弹出,但屏幕是黑色的。不管怎样谢谢你!

I want to present a ViewController every time the app starts even from background, I have this code:

mainViewController *mainController = [[mainViewController alloc] init];
UIViewController *src = (UIViewController *) self.window.rootViewController;
UIViewController *dst = (UIViewController *) mainController;
[src presentModalViewController:dst animated:YES];

The ViewController loads becuase the keyboard pops up but the screen is black. Anyway thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

檐上三寸雪 2025-01-15 05:08:01

没关系,我想通了,我把我想要从主故事板加载的视图放在一个笔尖和刚刚使用的 initWithNib 中。

It's ok I figured it out, I took the View I wanted to load out of the mainstoryboard and put it in a nib and the just used initWithNib.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文