I have a button in a Nib based view which does not behave like a button (the target method is never called). I have tried to dynamically add the button but it doesnt help.
I will try to describe the app structure (as I suspect it might be causing this issue) and I may not be using the right design pattern.
View A is tied to Controller AC. (loaded from a nib in the root controller and pushed on to the navigation controller.)
View A has multiple subviews embedded. Lets call one of those A'.
In the AC::viewDidLoad method:
I load 3 viewControllers a,b,c into member variables of AC.
Depending on the app settings I add the view of one of these controllers as the subview of A'
Essentially in the AC::viewDidLoad method:
[A' addSubView:(a.view)];
Now a.view has a button (which is tagged).I search for that tag. and Add a target Method to it dynamically. At this point the a.view is displayed as subview of A' and the button is also visible. Great.
But touch interaction does not happen or the touch action is consumed by someone other than my method.
I have tried a lot of variations but the execution never reaches my method. I even tried adding the target to all touchUpEvents. nothing. I checked the control values in the enabled events and that is correct. That button is simply disabled somehow. I wrote a simple app with one view and did the same, it worked. So I am thinking it is something to do with the way I am putting multiple pieces together.
Any Ideas?
I wish I had something like Spy++ where I could see the message Queue and see who was consuming this messages instead of my app or even look at the class object. I am a newbie to this platform. My earlier struggle with this is on this thread.