我在我的應用中有幾個UIPopover
s,其中包含UITableView
s。所有人在被解僱時都會發送消息popoverControllerDidDismissPopover:
。當某個特定的popover被解散時,我想要將所有用戶的選擇都移動到UITextView
。確定哪個UIPopover控制器已被解僱
我不能這樣做,除非我知道哪個popover正在被解僱。任何想法我可以做到這一點?
UIViewController* popoverContent = [[UIViewController alloc] init];
UIView *popoverView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 300, 416)]; // was 216
popoverView.backgroundColor = [UIColor redColor];
popoverContent.contentSizeForViewInPopover = CGSizeMake(300.0, 416.0);
// define UITableView
tvServices = [[UITableView alloc] init];
tvServices.frame = CGRectMake(0, 0, 300, 416);
tvServices.tag = 1201;
tvServices.delegate = self;
tvServices.dataSource = self;
// add it to the popover
[popoverView addSubview:tvServices];
popoverContent.view = popoverView;
popoverController = [[UIPopoverController alloc] initWithContentViewController:popoverContent];
popoverController.delegate = (id)self;
[popoverController setPopoverContentSize:CGSizeMake(300, 416) animated:NO];
// show it next to services textbox
[popoverController presentPopoverFromRect:soServices.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionRight animated:YES];
}
您可以在代理的方法'勾選駁回UIPopover做到這一點 - (無效)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController'那麼你可以通過isKindOfClass檢查:或等同標籤。 – 2013-04-10 21:51:24