IOS:Popover的位置

时间:2011-05-30 14:12:15

标签: xcode ios uitableview uipopovercontroller

我有这段代码:

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 animated:TRUE];

但是我想要在右下方小的弹出...我该怎么办?

1 个答案:

答案 0 :(得分:2)

我这样解决了:

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