-
Notifications
You must be signed in to change notification settings - Fork 200
/
Copy pathch20.txt
27 lines (23 loc) · 822 Bytes
/
ch20.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
chapter: Touch Screens
==================
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch* touch = [[event touchesForView:self] anyObject];
firstTouch = [touch locationInView:self];
self.status = YES;
[self trigger];
}
====================================
- (void)storeTouchPoints:(NSSet *)touches{
if ([touches count] > 0) {
for (UITouch *touch in touches) {
CGPoint *point = (CGPoint
*)CFDictionaryGetValue(touchBeginPoints, touch);
if (point == NULL) {
point = (CGPoint *)malloc(sizeof(CGPoint));
CFDictionarySetValue(touchBeginPoints, touch, point);
}
*point = [touch locationInView:view.superview];
}
}
==================