Objective c popViewController上的箭头不在我告诉它的地方

Objective c popViewController上的箭头不在我告诉它的地方,objective-c,ipad,uiimagepickercontroller,uipopovercontroller,cgrectmake,Objective C,Ipad,Uiimagepickercontroller,Uipopovercontroller,Cgrectmake,我有一个UIPickerController,当您单击按钮时会出现,尽管它上的箭头不会从底部改变位置,即使我使用UIPopoverArrowDirectionUp - (IBAction)addPicture:(id)sender { CGRect rect = CGRectMake(0,650,768,1024); [popOverController presentPopoverFromRect:rect inView:self.view permittedArrowDire

我有一个UIPickerController,当您单击按钮时会出现,尽管它上的箭头不会从底部改变位置,即使我使用
UIPopoverArrowDirectionUp

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


提前感谢

您正在发送一个从0和650开始的宽度为768、高度为1024的rect,因此它是导致此意外行为的一个巨大元素。您应该将用户正在按下的按钮的rect作为rect发送。试试这种方法

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

我猜这与你定义的帧有关你知道@J-manmorgant调用的是什么吗[yourPopover设置PopoOverArrowDirection:UIPopoOverArrowDirectionDown]在仅仅为了排除这个问题之后,我发现如果我改变一些尺寸,我可以把它放在顶部,虽然我不知道popover的尺寸,所以不能将其居中。UIPopover没有尺寸……你是通过放置在其中的元素来定义它的。