What i would do is add a touchable overlay behind your popup.
In your .h
@interface YourController : UIViewController{
UIView *overlay;
}
in your view did load
overlay = [[UIView alloc] initWithFrame:self.view.frame];
overlay.bakcgroundColor = [UIColor clearColor];
UITapGestureRecognizer *singleFingerTap =
[[UITapGestureRecognizer alloc] initWithTarget:self
action:@selector(handleSingleTap)];
[overlay addGestureRecognizer:singleFingerTap];
And then your methods would look like :
- (void) showPopView
{
[self.view addSubview:overlay];
self.popview.alpha = 1;
[self.popview setFrame:CGRectMake(15, 100, 300, 300)];
//[self dismissPopoverAnimated:NO];
}
- (void)handleSingleTap{
[overlay removeFromSuperview];
self.popview.alpha = 0;
[self.popview setFrame:CGRectZero];
}