Floating view over UITableView in RootViewController

Basically UITableView for RootViewController.

How can I add a view through the RootViewControllers TableView with its position relative to the screen and not the TableView so that it does not scroll it?

Note. This will be a progress bar showing the new data to load the table.

+7
source share
1 answer

This will help if you post your code, but: you are supposedly adding a UITableView to your RootViewController with something like this:

 [self.view addSubview:myUITableView]; 

Just add the floating view in the same way (for example, add it to the view controller, and not to your UITableView). If you add it after adding a table view, it will already be "above" the table view. Otherwise, you can bring it to the top with something like this:

 [self.view bringSubviewToFront:myOverlayView]; 

Your overlay view must be a subclass of UIView , and it must set its own backgroundColor - [UIColor clearColor] to make it transparent. To allow the user to continue interacting with the table view (which you apparently want to get), override the overlay subclass hitTest:withEvent: and return the table view (instead of returning self , which is the default behavior). This will cause everything to look like a table below.

+5
source

All Articles