我想知道的是如何識別用戶在模式對話框之外輕敲的時間。 我試過這個,但是當用戶在外面點擊時沒有被調用。如何在對話框打開時識別模式對話框外的輕擊手勢
這是我的viewDidLoad方法,它駐留在ModalDialogViewController.m文件中 UITapGestureRecognizer * recognitionizer;
if(![self.view.window.gestureRecognizers containsObject:recognizer])
{
recognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTapBehind:)];
//[recognizer setDelegate:self];
[recognizer setNumberOfTapsRequired:1];
recognizer.cancelsTouchesInView = NO; //So the user can still interact with controls in the modal view
[self.view.window addGestureRecognizer:recognizer];
}
這不是打開handleTapBehind方法。
我已經使模態視圖控制器成爲UIGestureRecognition的協議。
是的我已經在.h文件中設置了UIGestureRecognizerDelegate。 – user1898829 2013-04-08 12:03:36