0

以下文件添加到我的项目中

FPPopoverController.m and .h (the controller)
FPPopoverView.m and .h
FPTouchView.m and .h
ARCMacros.h

并在按下后调用以下函数UIBarButtonItem

-(IBAction)popover:(id)sender
{
    NSLog(@"Method called");

    //the view controller you want to present as popover
    MenuViewController *controller = [[MenuViewController alloc] init]; 

    //our popover
    FPPopoverController *popover = [[FPPopoverController alloc] 
                                          initWithViewController:controller]; 

    //the popover will be presented from the okButton view 
    [popover presentPopoverFromView:[sender valueForKey:@"view"]]; 

    //no release (ARC enable)
    //[controller release];
}

就在按下 UIBarButtonItem 之后,我看到了 LogMethod called但没有显示popover view

在我的项目转换为 ARC 之前,这是可行的。

发生了什么问题

4

1 回答 1

0

尝试这个

UIBarButtonItem *item = sender;
UIView *btnView = [item valueForKey:@"view"];
[popover presentPopoverFromView:btnView];
于 2014-11-17T07:33:23.457 回答