我正在尝试
PasswordViewController.h
@protocol PopoverDelegate <NSObject>
-(void)didClickButton;
@end
@interface PasswordViewController
@property(nonatomic, assign) id<PopoverDelegate> delegate;
PasswordViewController.m
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex {
if(passwordTest == 1 && buttonIndex == 0){
[self.delegate didClickButton];
}
}
SecondViewController.h
@interface SecondViewController : UIViewController <UIPopoverControllerDelegate, PopoverDelegate>
SecondViewController.m
#pragma mark -
#pragma mark PasswordViewController delegate
-(void)didClickButton {
if ([popoverController isPopoverVisible]) {
[self popoverControllerDidDismissPopover:popoverController];
[popoverController dismissPopoverAnimated:YES];
//Here, how should I refresh the screen?
}
}
#pragma mark -
#pragma mark UIPopoverController delegate
-(void)popoverControllerDidDismissPopover {
[popoverController dismissPopoverAnimated:YES];
popoverController.delegate = nil;
}