title: Subclass UIButton to add a property
body: <p>I'd like to subclass <code>UIButton</code> to add some properties that i need (not methods... only properties). </p>
  
  <p>Here the code of my subclass:</p>
  
  <pre><code>//.h-----------------------
  @interface MyButton : UIButton{
      MyPropertyType *property;
  }
  
  @property (nonatomic,retain) MyPropertyType *property;
  @end
  
  //.m--------------------------
  @implementation MyButton
  @synthesize property;
  
  @end
  </code></pre>
  
  <p>And here how I use the class: </p>
  
  <pre><code>MyButton *btn = ((MytButton *)[MyButton buttonWithType:UIButtonTypeRoundedRect]);
  btn.property = SomeDataForTheProperty;
  </code></pre>
  
  <p>From where i obtain this error : </p>
  
  <pre><code> -[UIRoundedRectButton setProperty:]: unrecognized selector sent to instance 0x593e920
  </code></pre>
  
  <p>Thus, from <code>ButtonWithType</code> i obtain a <code>UIRoundedRectButton</code> and <code>(Mybutton *)</code> can't cast it...
  What i have to do to obtain a <code>MyButton</code> object ? is <code>-init</code> the unique solution ?</p>
  
  <p>Thank you!</p>