0
我創建了一個按鈕:按鈕響應UIControlEventTouchUpInside並觸及方法
button = [StretchableButton new];
[button addTarget:mainViewController action:@selector(addNumberFromButton:) forControlEvents:UIControlEventTouchUpInside];
裏面的StretchableButton
I類有:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
[self.nextResponder touchesBegan:touches withEvent:event];
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
[self.nextResponder touchesMoved:touches withEvent:event];
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
[self.nextResponder touchesEnded:touches withEvent:event];
}
觸摸方法被調用,但button
沒有的點擊反應。
任何人都可以幫助我嗎?
我不知道你正在試圖讓按鈕在這裏做...你是不是想使拖動的按鈕的寬度擴大? (我猜是因爲你稱之爲可拉伸按鈕) – mdominick 2012-02-29 14:17:13
對不起,我的英文。我有按鈕查看。如果觸摸按鈕並將其拉出,我想用手指移動視圖。如果我只是觸摸按鈕,我想調用方法addNumberFromButton: – Radislav 2012-02-29 14:19:34
好的。由sch列出的超級事物應該工作。祝你好運。 – mdominick 2012-02-29 14:24:11