How to add a view on top of a UIPopoverController

十年热恋 提交于 2019-11-30 15:32:04

Got it. UIWindow works fine. Code:

// when drag starts
draggingView = [[UIWindow alloc] initWithFrame:CGRectMake(0,0,100,100)];
draggingView.windowLevel = UIWindowLevelAlert;
draggingView.center = [gestureRecognizer locationInView:self.view.window];
[draggingView makeKeyAndVisible];

// when drag ends
[draggingView release];
draggingView = nil;
gabuchan

Adding the Swift Version:

    let windows: [UIWindow] = UIApplication.shared.windows
    let firstWindow: UIWindow = windows[0]

    firstWindow.addSubview(loadingView)
    firstWindow.bringSubview(toFront: loadingView)

EDIT to admin: thanks for the review – deleted my other answer in duplicate How to show a UIView OVER a UIPopoverController

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