当前位置: 动力学知识库 > 问答 > 编程问答 >

objective c - ios STPopup dismiss by tapping in background

问题描述:

I've used STPopup library for created a popup in iOS app with Objective-c, so everything was fine.

Now I want dismiss popup by tapping in background but my code don't work and get error 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];

}

Any idea?

分享给朋友:
您可能感兴趣的文章:
随机阅读: