我试图在ios中拖延.如果拖动移动距离很短,我会将拖动计为点击事件,方法是将开始x,y(来自touchesBegan)与touchesEnd中的x,y进行比较.似乎touchesEnd永远不会被调用.我给了一个断点来验证它并且断点从未消失.
code:
- (void) touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
NSUInteger touchCount = [touches count];
NSUInteger tapCount = [[touches anyObject] tapCount];
[ self UpdateDrag];
}
- (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
NSUInteger touchCount = [touches count];
NSUInteger tapCount = [[touches anyObject] tapCount];
}
- (void) touchesEnd:(NSSet *)touches withEvent:(UIEvent *)event {
// this methes never gets called
NSUInteger touchCount = [touches count];
NSUInteger tapCount = [[touches anyObject] tapCount];
if (mDisplay==nil)
{
mDisplay = [[cDisplayYesOrNo_iPhone alloc]
initWithNibName:@"cDisplayYesOrNo_iPhone"
bundle:[NSBundle mainBundle]];
}
[ mDisplay SetUp];
[self presentModalViewController: mDisplay animated:NO];
}
Run Code Online (Sandbox Code Playgroud)
是- (void)touchesEnded:不是- (void)touchesEnd:
| 归档时间: |
|
| 查看次数: |
922 次 |
| 最近记录: |