title: Custom View in UIAlertController
body: <p>I am trying to put a custom view inside a <code>UIAlertController</code>. I'm running into some odd issues with the sizing of the custom view.</p>
  
  <p>I want the custom view to span the width of the <code>UIAlertController</code>, whatever that might be. I'm using <code>CGRectGetWidth(alertController.view.bounds)</code> to get the width of the alert controller. However, this seems instead to be returning the width of the entire view. using <code>view.frame</code> does not make a difference.</p>
  
  <pre><code>UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"My Title" message:nil preferredStyle:UIAlertControllerStyleAlert];
  
  UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(alertController.view.bounds), 50)];
  view.backgroundColor = [UIColor blueColor];
  
  [alertController.view addSubview:view];
  [self presentViewController:alertController animated:YES completion:nil];
  </code></pre>
  
  <p>This yields the results below. I have the same issue trying to get X, Y width and height properties of the <code>UIAlertController</code>. Does anyone know how I can position this view in the middle of the alert controller without using hard-coded numbers?</p>
  
  <p><a href="https://i.stack.imgur.com/gnN9c.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gnN9c.png" alt="enter image description here"></a></p>