相关疑难解决方法(0)

跟踪多点触控中的触控点

我正在制作一个绘图项目,我想支持多点触控,我已经通过在线文档,建议跟踪触摸点,我做了,但我没有得到理想的行为.我没有得到直线.

以下是我的代码

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.

    red = 0.0/255.0;
    green = 0.0/255.0;
    blue = 0.0/255.0;
    brush = 10.0;
    opacity = 1.0;

     self.view.multipleTouchEnabled = YES;

     touchPaths = [NSMutableDictionary dictionary];
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {


    for (UITouch *touch in touches)
    {
        NSString *key = [NSString stringWithFormat:@"%d", (int) touch];
        lastPoint = [touch locationInView:self.view];

        [touchPaths setObject:[NSValue valueWithCGPoint:lastPoint] forKey:key];
    }

}


- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{

    for (UITouch …
Run Code Online (Sandbox Code Playgroud)

core-graphics multi-touch uikit cgcontext ios

6
推荐指数
1
解决办法
1493
查看次数

标签 统计

cgcontext ×1

core-graphics ×1

ios ×1

multi-touch ×1

uikit ×1