我有一個根視圖控制器,其中我加載了一個包含三個按鈕的子視圖。當我觸摸其中的一個時,會顯示彈出窗口。彈出窗口包含一個圖像視圖和一個帶有完成按鈕的欄。我想在完成按鈕被觸摸時關閉此彈出窗口。要做到這一點,我使用這個代碼關閉彈窗視圖
- (IBAction)btnDone:(UIBarButtonItem *)sender {
[self.view removeFromSuperview];
[APPDELEGATE.parkDetail. popoverController dismissPopoverAnimated:YES];
// [APPDELEGATE.parkDetail.popoverController dismissPopoverAnimated:YES ];
}
和酥料餅提出這樣
- (IBAction)btnParkMap:(id)sender {
[popoverController dismissPopoverAnimated:YES];
if ([popoverController isPopoverVisible]) {
[popoverController dismissPopoverAnimated:YES];
} else {
parkMap * v = [[parkMap alloc]initWithNibName:@"parkMap" bundle:nil];
v.contentSizeForViewInPopover = CGSizeMake(350, 300);
popoverController = [[UIPopoverController alloc] initWithContentViewController:v];
CGRect popRect = CGRectMake(self.btnShowPopover.frame.origin.x+330,
self.btnShowPopover.frame.origin.y+170,
self.btnShowPopover.frame.size.width,
self.btnShowPopover.frame.size.height);
[popoverController presentPopoverFromRect:popRect inView:self.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}
}
你已經完成parkMap類的按鈕了嗎? –