0

我在 NavigationBar 中创建了一个 UIBarButtonItem:

UIBarButtonItem *filtroFecha = [[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemSearch target:self action:@selector(filtrarFecha:)]autorelease];


    self.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects: addActivity, filtroFecha, nil];

现在我想从此按钮打开一个弹出窗口,但我无法获得 UIBarButtonItem 的框架。

if (_filtroActividadesView == nil) {
        self.filtroActividadesView = [[CRMFiltroActividadViewController alloc] init];
        _filtroActividadesView.delegate = self;
        self.filtroPopover = [[UIPopoverController alloc] 
                                  initWithContentViewController:_filtroActividadesView];               
    }

    [self.filtroPopover presentPopoverFromRect:CGRectMake(0, 0, 1400, 44) inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];

谢谢!!

4

1 回答 1

4

使用presentPopoverFromBarButtonItem:permittedArrowDirections:animated:.

[self.filtroPopover presentPopoverFromBarButtonItem:filtroFecha permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];

于 2012-08-07T07:58:52.893 回答