title: Adding IB constraints breaks UIPickerview - ObjC
body: <p>I have a view built with interface builder. Whenever I add a pickerview (either via IB or programmatically) on top of the existing IB view, the pickerview will <strong>not</strong> work. The elements within the pickerview won't scroll properly... the spinner wheel always bounces back to the '0 position' &amp; nothing can be selected. Also, the wheel no longer 'clicks'... and the wheel moves in horizontally as well as vertically...  but nothing can be selected.</p>
  <p>I even tried to add the pickerview to an actionsheet... same result.</p>
  <p>If I completely remove ALL of the constraints in the view, the pickerview works as it should.</p>
  <p>Any ideas on what's causing this and/or how to fix?</p>
  <p><a href="https://media4.giphy.com/media/CU6mxQ9qW8n5o4aCKk/giphy.gif?cid=790b7611da1e657ad78c0bcbe902c5b9344291d996d5e4bf&amp;rid=giphy.gif&amp;ct=g" rel="nofollow noreferrer">screen shot</a></p>
  <p>Here's the code:</p>
  <pre><code>- (void)viewDidLoad {
      [super viewDidLoad];
      self.tabBarController.tabBar.hidden = YES;
      [self.view setBackgroundColor:[UIColor clearColor]];
      
  letterArray = @[@&quot;&quot;,@&quot;A&quot;,@&quot;B&quot;,@&quot;C&quot;,@&quot;D&quot;];
      
      UIBarButtonItem *pBtn = [[UIBarButtonItem alloc] initWithTitle:@&quot;picker&quot;
                                                                 style:UIBarButtonItemStylePlain
                                                                target:self
                                                                  action:@selector(launchPicker:)];
      self.navigationItem.rightBarButtonItem = pBtn;
  }
  
  - (void)launchPicker:(id)sender {
      self.viewForMainPicker = [[UIView alloc]initWithFrame:CGRectMake(0, 400, [[UIScreen mainScreen] bounds].size.width, 220)];
      UIToolbar *toolBar = [[UIToolbar alloc]initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, 44)];
      UIPickerview *mainPicker = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 0, [[UIScreen mainScreen] bounds].size.width, 220)];
      
      UIFont *arrowfont = [UIFont boldSystemFontOfSize:40];
      UIFont *titlefont = [UIFont boldSystemFontOfSize:28];
      UIBarButtonItem *doneBtn = [[UIBarButtonItem alloc] initWithTitle:@&quot;→&quot;
                                                                  style:UIBarButtonItemStylePlain
                                                                 target:self
                                                                 action:@selector(fakeEvent)];
      UIBarButtonItem *title = [[UIBarButtonItem alloc] initWithTitle:@&quot;Select Gender&quot;
                                                                style:UIBarButtonItemStylePlain
                                                               target:nil
                                                               action:nil];
      UIBarButtonItem *flex = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace
                                                                            target:self
                                                                            action:nil];
      [doneBtn setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                       [UIColor colorWithRed:0.933 green:0.122 blue:0.145 alpha:1.00], NSForegroundColorAttributeName,
                                       arrowfont, NSFontAttributeName, nil] forState:UIControlStateNormal];
      [title setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:
                                       [UIColor colorWithRed:0.933 green:0.122 blue:0.145 alpha:1.00], NSForegroundColorAttributeName,
                                       titlefont, NSFontAttributeName, nil] forState:UIControlStateNormal];
      NSArray *btnArray = [[NSArray alloc] initWithObjects:flex,flex,title,flex,doneBtn,nil];
      
      mainPicker.delegate = self;
      mainPicker.dataSource = self;
      
      [toolBar setItems:btnArray];
      [viewForMainPicker addSubview:mainPicker];
      [viewForMainPicker addSubview:toolBar];
  
      [self.view addSubview:viewForMainPicker];
  }
  
  - (void)fakeEvent {
      NSLog(@&quot;selected&quot;);
  }
  
  - (NSInteger)numberOfComponentsInPickerView:(nonnull UIPickerView *)pickerView {
      return 1;
  }
  
  - (NSInteger)pickerView:(nonnull UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
      return letterArray.count;
  }
  
  - (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
      return letterArray[row];
  }
  
  - (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component {
      NSString *newString = [NSString stringWithFormat:@&quot;%@&quot;, letterArray[row]];
      NSLog(@&quot;passing: %@&quot;,newString);
  }
  </code></pre>