gpt4 book ai didi

ios - UIAlertView 在应用程序的最开始处 :didFinishLaunchingWithOptions:

转载 作者:行者123 更新时间:2023-11-29 03:29:10 25 4
gpt4 key购买 nike

我在应用程序一开始就有以下内容:didFinishLaunchingWithOptions:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{

UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:@"Reminder:" message:@"foo" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
[alertView show];
NSLog(@"%@ is the parent view",[alertView superview]); // prints "(null)"

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
...
}

并且 UIAlertView 仍然出现。这怎么行得通?

最佳答案

警报 View 显示在自己的窗口中。但是,直到运行循环有机会运行时,这种情况才会发生。当您记录警报 View 的 super View 时,警报尚未显示,这就是您得到 (null) 的原因。

关于ios - UIAlertView 在应用程序的最开始处 :didFinishLaunchingWithOptions:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20027502/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com