本文介绍了FPPopover 不会在按下按钮时弹出,只是 NSLogs“FPPopoverController dealloc";的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下代码:

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

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

到底是什么导致我的应用每次按下按钮都会 NSLog "FPPopoverController dealloc"?

What exactly is causing my app to NSLog "FPPopoverController dealloc" every time I press the button?

推荐答案

这是我在生产中运行的实现.试试这个.可能只是您没有正确设置所有属性.

Here's my implementation that's working in production. Try this out. It may just be that you haven't set all the properties correctly.

//实例化弹出框

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];

让我知道是否有帮助

这篇关于FPPopover 不会在按下按钮时弹出,只是 NSLogs“FPPopoverController dealloc";的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-22 08:09