title: How to add a UIButton at runtime
body: <p>I am trying to add a <code>UIButton</code> at runtime however it is not visible. What am I doing wrong?</p>
  
  <pre><code>- (id)initWithFrame:(CGRect)frame {
      if (self = [super initWithFrame:frame]) {
          UIButton *btn = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];
          btn.frame = CGRectMake(0, 0, 100, 25);
          btn.backgroundColor = [UIColor clearColor];
          [btn setTitle:@"Play" forState:UIControlStateNormal];
          [btn addTarget:self action:@selector(buttonClick:)
          forControlEvents:UIControlEventTouchUpInside];
          btn.center = self.center;
          [self addSubview:btn];
      }
      return self;
  }
  </code></pre>