使用alertView关闭popover

时间:2011-11-29 05:16:14

标签: ipad uialertview uipopovercontroller page-refresh

我正在尝试

  • 使用alertView和
  • 关闭弹出窗口
  • 刷新屏幕,以便我无法再次链接到弹出窗口。这是我的代码,请帮我解决这个问题:

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;
}

0 个答案:

没有答案