2010-03-10 40 views

回答

1

您可以使用UIView子類並在那裏處理觸摸事件。方法來看待(在UIResponder定義):

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event 
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event 
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event 

如果你想用「隱形」 UIButton應其類型設置爲UIButtonTypeCustom - 默認情況下它可以在沒有圖像和標題,並用透明背景出現。所以從技術上講,它對用戶是不可見的,但仍能夠對所有事件做出響應。

相關問題