views:

36

answers:

1

Hi,

my current scenario is this -> i am showing a view controller that has a button. when i click that button a small view opens. now what i want. when that view is shown i don't want user to touch below that ( even in navigation bar's back button ). the same thing which UIAlertView does. how i can achieve that thing with my custom view ??

Please suggest.

+1  A: 

You could cover the current view with a different UIView which would take the touches and stop them. Here's some code to overlay a UIView which is black (and slightly transparent) to block touches.

UIView *blackView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)]; 
blackView.backgroundColor = [UIColor blackColor];
blackView.alpha = 0.8f;
[self.view addSubview:blackView]; 

UPDATE

To disable the back button, try using the following.

self.navigationItem.leftBarButtonItem.enabled = NO;
Joshua
but this will not stop touches on navigation controller. the back button will still work. i want that the back button on navigation controller should not work. how to do that ?
g.revolution
Please check my updated answer.
Joshua