How to get UIButton Target, Action and Control events?
<p>I am using UIImageView's with UIButtons a whole bunch.  So, I created a custom class to permanently marry these two an make things a little simpler.  It all works well until I decided to implement -(id)initWithObject:(AUIImageViewButton *) imageViewButton.</p>

<p>Clearly I need to copy all relevant properties from the imageViewButton object being passed. The UIImageView is not problematic at all.  Something like this deals with it:</p>

<pre><code>imageview = [[UIImageView alloc] initWithFrame:imageViewButton.imageview.frame];        // Copy all relevant data from the source's imageview
[imagebutton.imageview setBackgroundColor:imageViewButton.imageview.backgroundColor];   //
[imagebutton.imageview setImage:imageViewButton.imageview.image];                       //
</code></pre>

<p>Most of the button stuff is also readily available:</p>

<pre><code>button = [UIButton buttonWithType:imageViewButton.button.buttonType];                   // Copy all relevant data from the source's button
button.frame = imageViewButton.imageview.frame;                                         // 
[button setTitle:imageViewButton.button.titleLabel.text forState:UIControlStateNormal]; //
button.tag = imageViewButton.button.tag;                                                //
</code></pre>

<p>I am having a little trouble figuring out how to get all the data for the addTarget:action:forControlEvents method.</p>

<p>Looking at the docs I can see that I might be able to use UIControl's allControlEvents and allTargets methods.  I'll dig into that right now and see how much trouble I can get into.  The one I am not sure about is the action.  </p>

<p>Can anyone give me a shove in the right direction?</p>

<p>Thanks,</p>

<p>-Martin</p>
