按下按钮时不会弹出FPPopover,只是NSLogs“FPPopoverController dealloc”

时间:2013-03-28 00:12:19

标签: ios objective-c uipopovercontroller fppopover

我有以下代码:

- (IBAction)textOptionsTapped:(UIBarButtonItem *)sender {
    UIView *buttonView = [sender valueForKey:@"view"];

    FPPopoverController *popover = [[FPPopoverController alloc] init];
    popover.arrowDirection = FPPopoverArrowDirectionDown;
    [popover presentPopoverFromView:buttonView];
}

每次按下按钮,我的应用程序究竟是什么导致NSLog“FPPopoverController dealloc”?

1 个答案:

答案 0 :(得分:0)

这是我在生产中使用的实现。试试吧。可能只是你没有正确设置所有属性。

//实例化popover

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard" bundle:nil];
LoginViewController *viewController = [storyboard instantiateViewControllerWithIdentifier:@"LoginViewController"];

if (self.popover) {
    [self.popover dismissPopoverAnimated:NO];
    self.popover = nil;
}

self.popover = [[FPPopoverController alloc] initWithViewController:viewController];
self.popover.contentSize = viewController.size;
self.popover.border = NO;
self.popover.arrowDirection = FPPopoverNoArrow;
self.popover.tint = FPPopoverRedTint;

[self.popover presentPopoverFromView:self.loginButton];

如果有帮助,请告诉我