gpt4 book ai didi

ios - 使用 CFDictionary 跟踪 UITouches

转载 作者:行者123 更新时间:2023-11-29 13:28:10 26 4
gpt4 key购买 nike

<分区>

我正在寻找一些示例代码来使用 CFDictionary 跟踪 UITouches。不幸的是,apple-docs 没有完整的示例。

http://developer.apple.com/library/IOs/#documentation/EventHandling/Conceptual/EventHandlingiPhoneOS/MultitouchEvents/MultitouchEvents.html#//apple_ref/doc/uid/TP40009541-CH3-SW7

我目前正在使用 NSMutable 数组,但我想存储完整的 UITouch 对象,以便同时获取时间戳。

NSMutableArray *touchArray_val;


-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
touchArray_val = [[NSMutableArray alloc] init];
}

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

for(UITouch *t in touches){
CGPoint currentPoint = [t locationInView:self];
[touchArray_val addObject:[NSValue valueWithCGPoint: currentPoint]];
}

}

-(void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event{
NSLog(@"%i",[touchArray count]);

for(NSValue *val in touchArray_val){
NSLog(@"%@",val);
}
}

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com