title: How to add a button in UIScrollView with addSubview?
body: <p>I am new to iOS development and I have a problem with <code>UIScrollView</code>. First of all, I've created a Scroll View in a storyboard and added</p>
  
  <pre><code>@property (retain, nonatomic) IBOutlet UIScrollView *mainScroll;
  </code></pre>
  
  <p>in view controller handler</p>
  
  <p>In the <code>viewDidLoad</code> method I have the following code:</p>
  
  <pre><code>- (void)viewDidLoad
  {
      [super viewDidLoad];
  
      self.mainScroll.contentSize = CGSizeMake(100.0,100.0); // Have to set a size here related to your content.
      // You should set these.
      self.mainScroll.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
  
      self.mainScroll.minimumZoomScale = .5;  // You will have to set some values for these
      self.mainScroll.maximumZoomScale = 2.0;
      self.mainScroll.zoomScale = 1;
  
      UIButton* b = [[UIButton alloc] init];
      [b setBounds:CGRectMake(.0f,0.f,100.0,100.0)];
      [self.mainScroll addSubview:b];
  }
  </code></pre>
  
  <p>But the button does not appear in the simulator. However if I add a button on storyboard in the IB, the button appears and I can scroll the view.</p>
  
  <p>How can I add the button in code?</p>