自定义 UIwindow 不显示 [英] Custom UIwindow not display

查看:56
本文介绍了自定义 UIwindow 不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为 rootViewController 上的自定义警报创建一个新窗口.<前>- (void)viewdidAppear{UIWindow *newWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];newWindow.windowLevel = UIWindowLevelAlert + 1.0f;newWindow.backgroundColor = [UIColor redColor];newWindow.hidden = NO;

UIViewController *vc = [[UIViewController alloc] init];vc.view.backgroundColor = [UIColor blueColor];newWindow.rootViewController = vc;[newWindow makeKeyAndVisible];

但是新窗口不起作用.我对这个奇怪的问题感到困惑.我希望你能帮助我.

解决方案

解决方案是窗口集全局变量.Window makeKeyAndVisible 时,不释放窗口.

I'm trying to create a new window for Custom alert on rootViewController.

- (void)viewdidAppear
{
            UIWindow *newWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
            newWindow.windowLevel = UIWindowLevelAlert + 1.0f;
            newWindow.backgroundColor = [UIColor redColor];
            newWindow.hidden = NO;

UIViewController *vc = [[UIViewController alloc] init]; vc.view.backgroundColor = [UIColor blueColor]; newWindow.rootViewController = vc; [newWindow makeKeyAndVisible];

But the newWindow not working. I am confused with this strange question. I hope you can help me.

解决方案

Solution is window set Global variable. When Window makeKeyAndVisible,window was not be released.

这篇关于自定义 UIwindow 不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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