FPPopover won't pop up on button press, just N

2019-09-06 12:54发布

I have the following code:

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

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

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

1条回答
甜甜的少女心
2楼-- · 2019-09-06 13:11

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.

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

Let me know if that helps

查看更多
登录 后发表回答