//PopUpContentViewController 是自訂的需要彈出popover的viewcontrller,彈出框裡面顯示的內容就是這個
PopUpContentViewController *popContentViewControl = [[PopUpContentViewController
alloc] init];
// Setup the popover for use in the detail view. popOverMenu 是我之前聲明的UIPopoverController對象
//必須要用之前建立的彈出框內容viewcontroller來初始化popover
popOverMenu = [[UIPopoverController
alloc] initWithContentViewController:popContentViewControl];
//4.x的私人方法
[popOverMenu
setValue:[NSNumber
numberWithInt:2]
forKey:@"popoverBackgroundStyle"];
//對應的值有 0-黑色, 1-白色, 2-奶白色,
//還可以使用下面公有方法修改UIPopoverController裡面導航部分的背景顏色
//[[[popOverMenu contentViewController] view] setBackgroundColor:[UIColor orangeColor]];
//UIPopoverArrowDirectionDown表示箭頭方向,down表示向下
popOverMenu.popoverContentSize =
CGSizeMake(500,
30);
[popOverMenu
presentPopoverFromRect:CGRectMake(620, y,
100, 10)
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionDown
animated:YES];