我想在 iPad 中创建 UIPopOverController。当点击以编程方式显示的 UIBarButonItem 时,此 UIPopOverController 将打开。
UIButton *btnRight = [UIButton buttonWithType:UIButtonTypeCustom];
[btnRight setImage:[UIImage imageNamed:@"right.PNG"] forState:UIControlStateNormal];
btnRight.frame = CGRectMake(0, 0, 32, 32);
[btnRight addTarget:self action:@selector(pressDone) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *btnRightBarItem= [[UIBarButtonItem alloc] initWithCustomView:btnRight];
[[self navigationItem] setRightBarButtonItem:btnRightBarItem];
我的选择器代码是:
- (void)pressDone:(id)sender
{
PopoverViewController *PopoverView =[[PopoverViewController alloc] initWithNibName:@"PopoverViewController" bundle:nil];
self.popOver =[[UIPopoverController alloc] initWithContentViewController:PopoverView];
[self.popOver presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}
当我使用上面的代码时,我得到了错误,
[HrOfferDetailVC pressDone]: unrecognized selector sent to instance 0x73bb670'