title: resizing UIPickerView
body: <p>I'm trying to create an UIPickerView in UIAlertView, I wrote the following code</p>
  
  <pre><code>UIAlertView *alert = [[UIAlertView alloc] initWithFrame:CGRectMake(0, 0, 300, 200)];
  
  alert.title = @"Preferences";
  alert.message = @"\n\n\n\n\n\n\n";
  alert.delegate = self;
  [alert addButtonWithTitle:@"Cancel"];
  [alert addButtonWithTitle:@"OK"];
  
  
  UIPickerView *myPickerView = [[UIPickerView alloc] initWithFrame:CGRectZero];
  myPickerView.delegate = self;
  myPickerView.showsSelectionIndicator = YES;
  myPickerView.autoresizingMask = UIAlertViewStyleDefault;
  
  myPickerView.frame = CGRectMake(10, 40, 250, 150);
  
  [alert addSubview:myPickerView];
  
  [alert show];
  </code></pre>
  
  <p>but when run, the pickerView size is not fit the alert view, it looks as shown in the image.</p>
  
  <p><a href="http://dt-works.com/emy/Screen%20Shot%202012-07-31%20at%2010.44.12%20AM.png" rel="nofollow">here image</a></p>
  
  <p>how can I solve this issue? 
  Thanks in advance.</p>
  
  <hr>
  
  <p>I solved it, I discovered that I have the following code </p>
  
  <pre><code>- (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component    {
  int sectionWidth = 300;
  
  return sectionWidth;
  }
  </code></pre>
  
  <p>when I removed this, It fixed. :)
  thanks for everyone tried to help me, and I'm very sorry for my mistake. :$</p>