So when a user clicks on a button in my app, I would like to create a new view with an activity indicator and cover the whole screen with it until the button action finishes.
However, my activity indicator view is covering only inside of a table view, it looks like this:
How to make it cover whole screen? Including the navigation controller and table view toolbar.
Here is my code I use to create the view:
self.overlayView = [[UIView alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.overlayView.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.5];
self.activityIndicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
self.activityIndicator.center = self.overlayView.center;
[self.overlayView addSubview:self.activityIndicator];
[self.activityIndicator startAnimating];
[self.tableView addSubview:self.overlayView];
Change
[self.tableView addSubview:self.overlayView];
To
[self.navigationController.view addSubview:self.overlayView];
Set the overlay's rect accordingly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With