Custom UIwindow not display

跟風遠走 提交于 2019-12-25 23:16:14

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/28002992/custom-uiwindow-not-display

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!