1
我有2個按鈕與 「UILongPressGestureRecognizer」,要做到這一點,我做的:UILongPressGestureRecognizer有不同的按鈕
Fot的按鈕1:
-(IBAction)seleccionar46:(id)sender{
UILongPressGestureRecognizer *longpressGesture =[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressHandler:)];
longpressGesture.minimumPressDuration = 3;
[longpressGesture setDelegate:self];
[self.button1 addGestureRecognizer:longpressGesture];}
對於按鈕2:
-(IBAction)seleccionar46:(id)sender{
UILongPressGestureRecognizer *longpressGesture =[[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressHandler:)];
longpressGesture.minimumPressDuration = 3;
[longpressGesture setDelegate:self];
[self.button2 addGestureRecognizer:longpressGesture];}
而且在「longpressGesture」我需要區分button1和button2,但我不能這樣做...
- (void)longPressHandler:(UILongPressGestureRecognizer *)gestureRecognizer{//Here i need do the differentation}
謝謝大家!
此致敬禮。
感謝朋友做的按鈕!我需要保存名稱NSSttring中的按鈕...我該怎麼做? – 2012-02-13 19:10:18
爲什麼這樣做?... – Daniel 2012-02-13 19:17:14
因爲按鈕的名稱與一個圖像的名稱相同...而當我按下按鈕3秒鐘時,它會顯示與按鈕相關的圖像...我希望你可以不言而喻...感謝所有丹尼爾 – 2012-02-13 19:21:38