FPPopover won't pop up on button press, just NSLogs “FPPopoverController dealloc”

故事扮演 提交于 2019-12-24 20:17:53

问题


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:


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



来源:https://stackoverflow.com/questions/15671963/fppopover-wont-pop-up-on-button-press-just-nslogs-fppopovercontroller-dealloc

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!