Quote:
Originally Posted by .mb
I've been following this thread for a while, and I have a question. How would you only target once instance of the newEnemy? For instance if I wanted to just be able to touch one and delete that one.
|
Short question, long answer - to get the UIImageView to respond to touches, you'll have to subclass UIImageView. Inside your subclass, you'll want to do self.userInteractionEnabled=YES and implement the "touchesEnded:withEvent:" method from UIResponder.
You could also use UIButtons instead, which would let you define a button action - but long-term, subclassing UIImageView will allow you to add other variables you might need (like separate direction/velocity) to each enemy / ball / whatever.
EDIT: you don't have to subclass. Your viewController will get the touchesEnded:withEvent: message, and you could loop through the objects to see which one the touch intersects.