You can simply add a transparent subview in front of your view and place a button on that transparent view:
UIView* maskView = [[UIView alloc] initWithFrame:self.view.bounds];
maskView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.view addSubview:maskView];
[maskView addSubview:buttonView];
And make sure that this transparent view is the last subview added or just clicks it on the front of viewWillAppear:
[self.view bringSubviewToFront:maskView]
source
share