1
我有一個簡單的UIView使用像容器。 如果我寫這個代碼:touchesForView hitTest
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
UIView *hitView = [super hitTest:point withEvent:event];
NSSet *sTouches = [event touchesForView:self];
NSLog(@"Touches %d", [sTouches count]);
return self;
}
不行!在touchesBegan()之前,我希望能夠在hitTest()消息中獲得接觸。 這可能嗎?
我有這樣的層次:
UIView
+---> UIScrollView
當我UIView
(單一的水龍頭)容器移動觸摸。當我在我的UIView
上雙擊(雙指)時,子女UIScrollView
不適用於縮放(例如)。 所以我想抓住觸動數字。
如果觸摸號碼等於1,我的UIView
容器上的hitTest
返回「self」。 否則,如果觸摸數字很大(== 2),hitTest
返回「scrollview」指針。
換句話說,我想抓住兩個手指事件到hitTest()消息/事件。
好吧,我有這個層次: 的UIView --->的UIScrollView 當我UIView(單一的水龍頭)容器移動觸摸。 當我雙擊我的UIView,子UIScrollView不適用於縮放(例如)。 所以我想抓住觸動數字。如果觸摸號碼等於1,我的UIView容器上的hitTest返回「self」。 否則,如果觸摸數字很大(== 2),hitTest返回「scrollview」。 – Undolog 2010-01-13 20:33:31