I’m trying to call a method in my main view (TapView) from a button in my popover (pop)
Now at the minute I have
-(void)popoverControllerDidDismissPopover:
(UIPopoverController *)pop {
[self noise];
}
Setup so that when the popover is dismissed it runs the method. This works, and is ‘acceptable’
What I would rather have happen though is that the user presses a UIButton (let’s call it…’load1′ in the popover and that this calls the method instead.
Anyone got any bright ideas on this? I’m sure it’s dead simple but Im not really sure ‘what’ it is I’m trying to do, so searching for answers has given a rather huge range of options.
EDIT: This how I’m calling my popover. That might help.
saveLoadScifi *sLoad = [[saveLoadScifi alloc] init];
UIPopoverController *pop = [[UIPopoverController alloc] initWithContentViewController:sLoad];
[pop setDelegate:self];
CGRect popoverRect = [self.view convertRect:[sender frame]
fromView:[sender superview]];
[pop presentPopoverFromRect:popoverRect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
In your popover controller’s header, add:
Synthesize that. When you create the popover (
I’m assuming somewhere in TapView.m youreferencing the code you posted), setalloc/inityour popoverafter the
alloc/init. In this case,selfwould be in the instance of TapView that you want to call a method on.The button should invoke an action method:
Hook up that method (with a proper declaration in the header:
-(IBAction)noise;) and you’re good to go.