Add UIView Above All Other Views, Including StatusBar

前端 未结 3 1787
悲哀的现实
悲哀的现实 2020-11-28 21:13

I\'m wanting to create a view (UIControl) which blocks all input and shows a UIActivityIndicatorView while authenticating a user.

The UIActionSheet and UIAlertView b

3条回答
  •  难免孤独
    2020-11-28 21:54

    I needed to present a view on top of all other views within my main window. Initially, I thought of presenting another window on top of my key window. Since, apple discourages using multiple windows, I decided against it.

    The following code did the trick for me:

    I added my view as a sub view to my key window which automatically presents my view on top of all other views. In my case this code is in app's delegate

    [self.window addSubview:topViewController.view]
    

    And when I am done with the view, the following code removes it from the window.

    [topViewController.view removeFromSuperview];
    

提交回复
热议问题