On Dec 7, 2009, at 4:12 pm, Chunk 1978 wrote:
> if ([[[event allTouches] anyObject] view] == self)
> {
> for (UITouch *touch in touches)
> {
> CGPoint touchPoint = [[touches anyObject]
> locationInView:self];
> switch ([touches count])
> {
> case 1: [self Touch1:touchPoint];
> break;
>
This logic doesn't make sense at all.
Moreover the custom method doesn't follow any standard Cocoa naming conventions.
You probably want something more like:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
NSMutableArray *myTouches = [[NSMutableArray alloc] initWithCapacity:5];
NSArray *myLabels = [[NSArray alloc] initWithObjects:touchLabel1,
touchLabel2, touchLabel3, touchLabel4, touchLabel5, nil];
UITouch *touch;
for (touch in touches) {
if (touch.view == self) {
[myTouches addObject:touch];
}
}
NSUInteger i, count;
count = [myTouches count];
for (i = 0; i < 5; i++) {
UILabel *label = [myLabels objectAtIndex:i];
NSString *text = @"";
if (i < count) {
UITouch *touch = [myTouches objectAtIndex:i];
text = NSStringFromCGPoint([touch locationInView:self]);
}
label.text = text;
}
[myTouches release];
[myLabels release];
}
(First pass, there may be a better strategy, but at least this will work.)
mmalc
_______________________________________________
Cocoa-dev mailing list ([email protected])
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com
This email sent to [email protected]