James Dunay
James Dunay

Reputation: 2724

Do i need to release UITouch objects?

I have a method such as this:

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

    //Use to animate drag
    UITouch *touch = [touches anyObject];
    CGPoint currentLocation = [touch locationInView:self];
    [self colorDragedOver:currentLocation];

    [touch release];

}

Do I need to release either the UITouch or the CGPoint to prevent any leaks?

Thanks!

Upvotes: 0

Views: 438

Answers (1)

amattn
amattn

Reputation: 10065

No. You never alloc/init or copy the touch so it is considered autoreleased.

CGPoint isn't an object or a reference so should never be released or autoreleased.

Upvotes: 2

Related Questions