0

I have a UIPickerController that appears when you click a button though the arrow on it doesn't change position from the bottom even when I use UIPopoverArrowDirectionUp.

- (IBAction)addPicture:(id)sender {
    CGRect rect = CGRectMake(0,650,768,1024);
    [popOverController presentPopoverFromRect:rect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}

I guess this must be quite common

Thanks in advance

Hive7
  • 3,599
  • 2
  • 22
  • 38

1 Answers1

2

You are sending a rect that has as width 768 and height 1024 starting on 0 and 650, so its a huge element that is causing this unexpected behaviour. You should send as rect the rect of the button the user is pressing. Try this way instead.

- (IBAction)addPicture:(id)sender {
    [popOverController presentPopoverFromRect:[sender frame] inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}
CoderPug
  • 908
  • 9
  • 19