title: Horizontal scroll with buttons in iOS
body: <p>I have implemented following horizontal scroll with buttons, but it seems like it starts scrolling only after 5 seconds. It got stuck. UI is getting blocked, I guess.</p>
  
  <p>I have following code to create that in my <code>ViewDidLoad()</code></p>
  
  <pre><code> UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0,self.view.frame.size.height-100, self.view.frame.size.width, 100)];
  
      int x = 10;
      for (int i = 0; i &lt; 10; i++) {
          UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(x,10,80,80)];
          [button setTitle:[NSString stringWithFormat:@"Button %d", i] forState:UIControlStateNormal];
          [button setTag:i];
          [button setBackgroundColor:[UIColor greenColor]];
          [button addTarget:self action:@selector(onClickofFilter:) forControlEvents:UIControlEventTouchUpInside];
          [scrollView addSubview:button];
  
          x += button.frame.size.width+10;
      }
  
      scrollView.contentSize = CGSizeMake(x, scrollView.frame.size.height);
      scrollView.backgroundColor = [UIColor redColor];
  
      [self.view addSubview:scrollView];
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/pYeku.png" alt="Image showing a row of green buttons on a red background."></p>
  
  <p>Is there any way to make it smooth?</p>