2010-04-16 38 views
0

我想用一個文本框和按鈕來使用UIview和UIImage的ontop,我希望用戶在UIview或視圖中的任何內容被觸摸時拖動它,那麼實現此方法的最佳方式是什麼?如何使用UIimage ontop檢測UIView上的觸摸?

UIView在單個視圖控制器上,並使用界面生成器來製作我的UIviews和UIimages。

回答

0

您需要繼承UIView和實施

- (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