我有这个代码:

if([self.popoverController isPopoverVisible])
{
    [self.popoverController dismissPopoverAnimated:YES];
    return;
}

UIViewController* popoverContent = [[UIViewController alloc]init];

popoverContent.view = tableView1.view;

self.popoverController = [[UIPopoverController alloc]
                          initWithContentViewController:popoverContent];

[self.popoverController presentPopoverFromRect:CGRectMake(1200, 280, 50, 50) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:TRUE];
[[[popoverController contentViewController] view] setAlpha:1]; //alpha del contenuto del popover

[popoverContent release];

它工作正常,但我无法将弹出框放在右下方,我尝试更改中的值
[self.popoverController presentPopoverFromRect:CGRectMake(1200, 550, 100, 100) inView:self.view allowedArrowDirections:UIPopoverArrowDirectionDown animation:TRUE];

但我希望这个弹出框在右下角很小……我该怎么办?

最佳答案

我是这样解决的:

[popoverController setPopoverContentSize:CGSizeMake(320.0f, 262.0f)];
[self.popoverController presentPopoverFromBarButtonItem:barButton permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

关于xcode - IOS:弹出框位置,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6177382/

10-12 14:45