3
A
回答
8
那麼你也可以使用addGestureRecognizer方法上的UIView像這樣:
// In some View controller
UITapGestureRecognizer *tapGR;
tapGR = [[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(handleTap:)] autorelease];
tapGR.numberOfTapsRequired = 1;
[myUIView addGestureRecognizer:tapGR];
// Add a delegate method to handle the tap and do something with it.
-(void)handleTap:(UITapGestureRecognizer *)sender
{
if (sender.state == UIGestureRecognizerStateEnded) {
// handling code
}
}
+0
謝謝!我會嘗試你的解決方案。 – ph3nx 2012-07-08 15:05:17
4
我不爲什麼使用隱藏的按鈕將不是一個聰明的辦法理解......它是由蘋果公司本身建議的方式,我認爲這是聰明,更好的這樣的時刻...
+1
是的,我同意:) – Bazinga 2012-07-08 10:20:55
0
使用- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
如果你正在尋找隨時隨地檢測沒有按鈕的觸摸屏上。您還可以找到觸摸的位置,像這樣:
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch *touch = [touches anyObject];
CGPoint *tLocation = [touch locationInView:self.view];
}
注:touchesEnded
被稱爲每一次視圖被竊聽,因此上述tLocation
將改變每個用戶觸摸屏幕的時間。
相關問題
- 1. 點擊查看asp:textbox?
- 2. 點擊kendoMobileList查看
- 3. 只顯示點擊查看
- 4. 點擊列表查看
- 5. 點擊查看時出錯
- 6. 點擊按鈕查看divs
- 7. 查看不接受點擊
- 8. 製作查看響應點擊事件
- 9. 查看按鈕上的活動點擊
- 10. 當點擊查看動畫後退
- 11. WPF點擊按鈕滾動查看器
- 12. 點擊手勢滾動查看IOS
- 13. DialogLauncher點擊動作
- 14. 如何在點擊後再次動態地點擊按鈕(將點擊看作是雙擊)JavaScript
- 15. Android TextView - 可點擊鏈接和可點擊查看
- 16. 當點擊複選框時,滾動查看消失點
- 17. 在動畫中點擊查看不起作用
- 18. 按鈕點擊動作關閉查看與extjs 4
- 19. 檢測雙擊(雙擊)或長時間點擊視頻查看
- 20. 看看複選框是否被點擊直到被點擊
- 21. 帶按鈕的單擊動作點擊
- 22. 點擊觸發JavaScript動作?
- 23. 動作腳本3點擊
- 24. 編輯點擊動作
- 25. check_box_tag與label_tag點擊動作
- 26. MVC按鈕點擊動作
- 27. 如何點擊動作
- 28. 點擊不執行動作
- 29. Selenium Web Driver點擊動作
- 30. Onmouse點擊顯示塊 - 點擊操作?
添加手勢識別器。可能的水龍頭。 – Bazinga 2012-07-08 10:10:01