Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

moonman239

Cancelled
Original poster
Mar 27, 2009
1,541
32
In another app I'm working on, there is a view controller. Within this view controller, there is a UIView. Within this UIView, there are multiple UIViews. I'll call them Amy, Bob, Carol, and Dan. I want Amy to do something when either Bob, Carol, or Dan gets dropped into her. However, I don't want Amy to respond to touchesBegan or touchesMoved, even if the touch begins inside Amy.

Each instance of Amy's class's parent, by default, responds to all touch events if the touch, or touches, start(s) inside it.
 
Well, if you call your UIView something, you are going to have control over it. A simple if statement is enough to stop it from moving
 
Have you tried to disable touch for Amy?

Code:
[amy setUserInteractionEnabled:NO];

I don't think that helped.

I wish I could just nullify the touchesBegan and touchesMoved methods present in the superclass's implementation so either iOS or the compiler treats them like they're not there.

Edit: Whether or not Amy's userInteractionEnabled property is set to NO, the app does not let the user move Amy.
 
In your original question, you never said you wanted the user to move Amy. You said you didn't want Amy to respond to touch events. You said you wanted Amy to perform an action when other views were dropped within her bounding rectangle.

Now you want Amy to move? I guess I don't really understand what you're looking to accomplish.
 
In your original question, you never said you wanted the user to move Amy. You said you didn't want Amy to respond to touch events. You said you wanted Amy to perform an action when other views were dropped within her bounding rectangle.

Now you want Amy to move? I guess I don't really understand what you're looking to accomplish.

OK, let me rephrase my original statement.

Amy, Bob, Carol, and Dan are all UIViews located within a UIViewController. I want the user to be able to move Bob, Carol, and Dan, but not Amy, whose position inside the view controller is supposed to be static.

My UIViewController has touchesBegan and touchesMoved methods that take care of the dragging part. I wanted Amy to do something when either Bob, Carol, or Dan was dragged inside her boundaries, because I believe it would be best to have the controller do as little as possible.

Anyways, I created a subclass of UIView and made the main view an instance of that subclass. I will redisable user interaction in my collection view. That way, the UIView will respond anytime a touch ends and pass all other events up the responder chain.
 
I just restructured my app so that Bob, Carol, and Dan respond every time a touch begins, moves, and ends. When the touch ends, they will send a message to their delegate.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.