I'm working on an iPhone app which uses a FPPopover, an open source library that enables popovers on iPhones. I have my PopoverTVC
displaying what I want, but I'm unable to figure out how to set my SavedPOITableViewController
as a delegate of PopoverTVC
without a segue.
SavedPOITableViewController
opens PopoverTVC
from a UIBarButtonItem
Should I even be using a delegate, or should I set up a NSNotification
on my SavedPOITVC's viewDidLoad
to listen for changes and post a notification on my PopoverTVC
when the myVariable
has updated?
Here's how my popover is instantiated on my SavedPOITableViewController
:
- (IBAction)filterButtonPressed:(UIBarButtonItem *)sender {
// The view controller you want to present as a popover
UIBarButtonItem *buttonItem = sender;
UIView *buttonView = [buttonItem valueForKey:@"view"];
PopoverTableViewController *categoryList = [[PopoverTableViewController alloc]init];
FPPopoverController *popover = [[FPPopoverController alloc]initWithViewController:categoryList];
categoryList.delegate = self; // this doesn't work
[popover setArrowDirection:FPPopoverArrowDirectionUp];
[popover presentPopoverFromView:buttonView];
}
I know this sounds startlingly stupid, but it's stumped me for more time than I care to admit.
When I try to set the delegate, I get this error:
Assigning to 'id<PopoverTableViewControllerDelegate>' from
incompatible type 'SavedPOITableViewController *const __strong'
My PopoverTVC
did not have a storyboard. I didn't bother to put one in because it's "out there on it's own". I threw an orphaned TableViewController on interface builder, assigned its class as PopoverTVC
and I'm the delegate works, despite a warning.
I don't understand why it works with the addition of an orphaned storyboard, but it didn't before with just code. If anyone can explain that, I'd love to hear the explanation.