Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IOS: How to put some view on top of presented modal view controller?

Tags:

I have an activity view that I have added in AppDelegate class to tap bar:

[self.mainTabBar.view addSubview: spinner]; 

When there are connection problems it is visible in each view controller and is spinning. There is some button at certain view controller, makes to present some modal view controller. That modal view controller overlaps the spinner. How to make that spinner always be on top of all views or at least on top of that modal view controller? I tried to make such a thing in view controller that presents modal view controller:

[self presentModalViewController:selectionViewController animated:YES]; [self.view bringSubviewToFront:[self.tabBarController.view viewWithTag:15]]; 

Not works.

like image 449
nik Avatar asked Mar 25 '12 10:03

nik


People also ask

How do I present a Viewcontroller on half screen?

Go to StoryBoard select subViewController and add a UIView in it. for all sides and change its color to black with the alpha you want. Set its height constraint to equal height with superview(self. View) and change its multipler to 0.33 or 0.34.

How do I present a view controller from another view controller?

You may also start segues from table rows and collection view cells. Right-click the control or object in your current view controller. Drag the cursor to the view controller you want to present. Select the kind of segue you want from the list that Xcode provides.


1 Answers

Add the view to the main window.

UIWindow* mainWindow = [[UIApplication sharedApplication] keyWindow]; [mainWindow addSubview: spinner]; 
like image 79
Felix Avatar answered Sep 21 '22 09:09

Felix