0
我試圖忽視我gestureRecognizer如果視圖感動是使用該特定類別(即UIButton
和UIBarButtonItem
)的:gestureRecognizer:shouldReceiveTouch:執行失敗
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
NSLog(@"%@", touch.view);
if ([touch.view isKindOfClass:[UIButton class]]){
return NO;
} else if ([touch.view isKindOfClass:[UIBarButtonItem class]]){
return NO;
}
return YES; // handle the touch
}
,對於UIButton
的偉大工程。它不適用於UIBarButtonItem
。我的NSLog結果當UIBarButtonItem
被觸摸是:
<UIToolbarTextButton: 0x7b8f500; frame = (4 0; 60 40); opaque = NO; layer = <CALayer: 0x7b8f900>> 2012-06-26 12:09:48.021
我試圖改變[UIBarButtonItem class]
到[UIToolBarTextButton class]
,但因爲這是一個無證類,我不能這樣做。任何其他方式來做到這一點?
謝謝。
你試過'UIBarItem'嗎? –
我剛剛做了,那似乎也沒有工作。 –
嘗試忽略整個酒吧! – trumpetlicks