views:

45

answers:

2

Hi, all!

I want to get pixeldata of an imageView (i.e. all the pixels occupied by the imageView in an NSMutableArray) which I need in order to detect collisions between two imageViews.

Can anybody please help me?

A: 

Unless you're doing some kind of color collision detection, you can use CGRectContainsPoint, CGRectContainsRect as a simple means of detecting collisions.

If you need to examine the pixels, you will need to get the CGImage of the image view's image and examine it with the methods it provides.

TechZen
Thanx, TechZen! It helped... I'm looking for the earlier case...
neha
A: 

Tak a look at the apple documentation page for getting the pixel data and then manipulating it. Technical Q&A QA1509 Getting the pixel data from a CGImage object

just use the [someUIImage CGImage] to get the CGImageRef of a certain UIImage which you must have plugged into your current UIImageView.

umerh
Thanx Umer... It helped!
neha