Search code examples
iphoneiosobjective-cuitableviewalertview

Dim background like when alertView pops up


I have a tableview that shows up when I push a button. This tableview is added on top of my other UITableview. What I want to do now is when the tableview shows up. My background view is dimmed like when an alertview pops up. You can see an example over here.

I've tried this in code but it doesn't work.

_tableView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5];

enter image description here


Solution

  • Just adding answer with more description that my comment.

    Say your Background tableView is _tableView and your pop up small tableView is _tableViewSmall

    1. Create a UIView having same height and width as of _tableView. Do addSubView on your _tableView. yourView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.5];

    2. Now add your _tableViewSmall doing addSubView on _tableView.

    Hope this steps helps you to make it..