开发者

IOS: Popover position

开发者 https://www.devze.com 2023-03-09 01:32 出处:网络
I have this code: if([self.popoverController isPopoverVisible]) { [self.popoverController dismissPopoverAnimated:YES];

I have this code:

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

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

popoverContent.view = tableView1.view; 

self.popoverController = [[UIPopoverControlle开发者_运维百科r 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];

It work fine, but I'm not able to place the popover in the lower right, I try to change values in [self.popoverController presentPopoverFromRect:CGRectMake(1200, 550, 100, 100) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionDown animated:TRUE];

but I want this popover small in lower right...how can I do?


I solved in this way:

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

精彩评论

暂无评论...
验证码 换一张
取 消