title: iOS Programming: Problem extending UIButton class
body: <p>I'm trying to extend UIButton class to add few methods but I'm having some problem when I try to init my object.</p>
  
  <pre><code>-(id)init{
  
  UIImage* image = [UIImage imageNamed:@"button_background.png"];    
  CGRect frame=  CGRectMake(100.0, 70.0, 45.0 ,45.0);
  
  self.frame = frame;
  
  [self setTitle:@"title" forState:UIControlStateNormal];
  [self setBackgroundImage:image forState:UIControlStateNormal];
  [self setImage:image forState:UIControlStateNormal];
  
  NSLog(@"type: %d",self.buttonType);
  NSLog(@"x: %f\ny: %f\nwidth: %f\nheight: %f",frame.origin.x, frame.origin.y ,frame.size.width, frame.size.height);
  NSLog(@"x: %f\ny: %f\nwidth: %f\nheight: %f",self.frame.origin.x, self.frame.origin.y ,self.frame.size.width, self.frame.size.height);
  
  if(self != nil){
      //
  }
  return self;
  </code></pre>
  
  <p>}</p>
  
  <p>It seams to work fine, there are no warning or error during execution.
  But in the console appears some inconsistency between values of frame and self.frame, and of course the button does not appear on screen.</p>
  
  <pre><code>type: 0
  x: 100.000000
  y: 70.000000
  width: 45.000000
  height: 45.000000
  
  x: 0.000000
  y: 0.000000
  width: 0.000000
  height: -1.998576
  </code></pre>
  
  <p>Please help me I'm getting out of my mind! :\</p>