FPPopover控制器没有显示

时间:2014-10-28 06:35:54

标签: ios objective-c iphone fppopover

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

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后,我看到了Log Method called但没有显示popover view

在将我的项目转换为ARC之前,这是有效的。

问题是什么

1 个答案:

答案 0 :(得分:0)

试试这个

UIBarButtonItem *item = sender;
UIView *btnView = [item valueForKey:@"view"];
[popover presentPopoverFromView:btnView];