我添加UILongPressGestureRecognizer
幾個UIButton
與代碼:要知道這UILongPressGestureRecognizer被觸發
UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(btnLong:)];
[btnOne addGestureRecognizer:longPress]; //there are btnTwo, btnThree for example
當我長按一個按鈕的方法被稱爲:
-(void)btnLong:(UILongPressGestureRecognizer *)gestureRecognizer{
if ([gestureRecognizer state] == UIGestureRecognizerStateBegan) {
}
}
我的問題是,我怎麼知道哪個UILongPressGestureRecognizer
被觸發,因爲UILongPressGestureRecognizer
沒有標籤屬性。
你覺得這是無聊找出超級視圖的位置來決定哪一個是cilicked – itenyh