我已经使用STPopup library在iOS应用中使用Objective-c创建了一个弹出窗口,所以一切都很好。
现在我想通过点击后台来解除弹出,但我的代码不起作用并收到错误backgroundViewDidTap]: unrecognized selector sent to instance 0x15780b7b0
ViewController.m
- (void)showPopupDaudit{
STPopupController *popupController = [[STPopupController alloc] initWithRootViewController:[POPViewController new]];
[STPopupNavigationBar appearance].tintColor = MP_HEX_RGB(MAINCOLOR);;
popupController.containerView.layer.cornerRadius = 4;
if (NSClassFromString(@"UIBlurEffect")) {
UIBlurEffect *blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleDark];
popupController.backgroundView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
}
[popupController.backgroundView addGestureRecognizer:[[UITapGestureRecognizer alloc] initWithTarget:popupController
action:@selector(backgroundViewDidTap)]];
[popupController presentInViewController:self];
}
POPUPController.m
- (IBAction)backgroundViewDidTap
{
[self.popupController dismiss];
}
有什么想法吗?