我有第一个显示start_game屏幕比当我点击按钮时,显示popupview使用xib.in xib类我有创建委托method.when我关闭弹出视图时调用委托方法,但没有调用自定义委托方法不呼叫
这里是我的委托类 .h文件中 #进口
@protocol digbuttonalertdelegate;
@interface digbuttonalert : UIViewController
@property (weak, nonatomic) IBOutlet UIImageView *bg_image;
@property (weak, nonatomic) IBOutlet UILabel *lbl_title;
@property (nonatomic, weak) id<digbuttonalertdelegate> delegate;
@end
@protocol digbuttonalertdelegate <NSObject>
@optional
-(void)digalertclose;
@end
.m File
#import "digbuttonalert.h"
#import "suggestion_alert.h"
#import "UIViewController+CWPopup.h"
#import "zoom_alert.h"
@interface digbuttonalert()
{
bool status;
}
@end
@implementation digbuttonalert
- (void)viewDidLoad {
[super viewDidLoad];
status=0;
UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapDetected)];
singleTap.numberOfTapsRequired = 1;
[self.bg_image setUserInteractionEnabled:YES];
[self.bg_image addGestureRecognizer:singleTap];
// Do any additional setup after loading the view from its nib.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)close:(id)sender {
}
-(void)tapDetected{
NSLog(@"single Tap on imageview");
if(status==0)
{
[email protected]"As you walk you will discover the hidden map.This circle will show your progress.";
status=1;
}
else
{
[self dismissViewControllerAnimated:YES completion:nil];
if ([self.delegate respondsToSelector:@selector(digalertclose)]) {
[self.delegate digalertclose];
}
}
}
这里这个类,我想调用方法
#import "digbuttonalert.h"
@interface start_games() <MJSecondPopupDelegate,digbuttonalertdelegate>
{
- (void)viewDidLoad {
digbuttonalert *next=[[digbuttonalert alloc]init];
next.delegate=self;
next.modalTransitionStyle=UIWebPaginationModeRightToLeft;
next.modalPresentationStyle=17;
[self presentViewController:next animated:YES completion:nil];
}
- (void)digalertclose
{
[self StartTimer];
[[NSUserDefaults standardUserDefaults]setObject:@"false" forKey:@"alertstatus"];
}
从正在推动digalertClose视图控制器后? – Darshana
@NinjaHattori in viewdidload puching digalert关闭vc – iosdv
你能分享一下这段代码吗? – Darshana