0

I have a drop down button and when user clicks on it dropdown appears which is a tableview that is hidden.

- (IBAction)showDropDown:(id)sender {
    self.tableView.hidden = NO;
}

Now i want to set entire screen overlay to 66% just like a blurry screen only excluding button and tableView. They must be visible clearly. And when user made as selection...

-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath{
    self.tableView.hidden = YES;
}

And everything will be same again.

naomi
  • 227
  • 1
  • 2
  • 9

2 Answers2

0

Okay so look here to learn how to make a blurring view

Creating a blurring overlay view

Now now a blurred View with the entire screen as the frame.

instead of addsubView to make it appear, use

[self.View insertSubview:blurredView belowSubView:yourTable];

Hope this is helpful..:)

Community
  • 1
  • 1
Mohamad Bachir Sidani
  • 2,077
  • 1
  • 11
  • 17
0

To insert overlay view as subview you have to use use UITableViewController instead of UIViewController
You can insert the overlay below the your table

view.insertSubview(view: overlayView, belowSubview: tableView)

But this will not overlay the entire screen (navigation bar and status bar is still visible)

To solve this, you have to create a new window

let window = UIWindow(frame: UIScreen.mainScreen().bounds)

window.addSubview(yourTableView)

// This will make window above the status bar
window.windowLevel = UIWindowLevelAlert

// Set to overlay color
window.backgroundColor = UIColor(white: 0, alpha: 0.66)

// Display the window that contains the table view
window.makeKeyAndVisible()
Edward Anthony
  • 3,354
  • 3
  • 25
  • 40