I’m quite new to Objective-C and so far I’m using a UIViewController and I’ve got Two UIPopoverControllers working within it but I want one to dismissPopoverAnimated when I open the other Here the code I’ve got so far for them:
-(IBAction)tabBtn1:(id)sender {
CapPhoto *capPhoto = [[CapPhoto alloc] init];
UIPopoverController *pop = [[UIPopoverController alloc] initWithContentViewController:capPhoto];
[pop setDelegate:self];
[pop presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
[pop setPopoverContentSize:CGSizeMake(200, 200)];
[capPhoto release];
}
-(IBAction)tabBtn2:(id)sender {
NewPhoto *newPhoto = [[NewPhoto alloc] init];
UIPopoverController *pop2 = [[UIPopoverController alloc] initWithContentViewController:newPhoto];
[pop2 setDelegate:self];
[pop2 presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
[pop2 setPopoverContentSize:CGSizeMake(200, 200)];
[newPhoto release];
}
So I’ve allocated two separate .xib files (CapPhoto & NewPhoto) as the PopoverControllers and I need one to dismiss when the other is called. Any ideas? cheers!
Here is an explanation on how to dismiss a UIPopoverController when opening another:
In your main viewcontroller.h file declare a UIPopover controller
then in your view controller.m file:
Boom. You’re done!