视图控制器和取消按钮之间的弹出框



我有两个表视图,假设一个和两个,当点击文本字段时,一个呈现两个,为此我有:

-(void) setProducts:(UITextField *) box
{
UIViewController *selectInBox = [self.storyboard instantiateViewControllerWithIdentifier:@"selectingProducts"];
popover = [[UIPopoverController alloc] initWithContentViewController:selectInBox];
[popover presentPopoverFromRect:box.bounds inView:box permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}
-(BOOL)textFieldShouldBeginEditing:(UITextField *) textField
{
if (textField.tag == 2)
{
    [self setProducts:textField];
}
一切正常,直到知道,表"二"

出现在弹出窗口内和文本字段下方,但表"二"有一个取消按钮,它应该关闭表视图"二"(在表视图"一"内)。所以我在表视图"两个"中使用了我的取消方法,我这样做了,但它不起作用,我认为它不能简单

- (IBAction)cancel:(id)sender
{
[self removeFromParentViewController];
}

我也试过:

- (IBAction)cancel:(id)sender
{
 one *aux = [[one alloc]init];
 [aux.popover dismissPopoverAnimated:YES] //popover is a property of tableview one.  
}

还尝试过:"如果自我被呈现"...什么都不起作用!

有什么想法吗?救命!

提前致谢

我已经非常成功地将其用于以表单表形式呈现的"弹出框"(模态)。

- (IBAction)cancelButtonTapped:(id)sender
{
    [self dismissViewControllerAnimated:YES completion:nil];
}

驳回弹出动画:是...应从呈现视图控制器调用。

最新更新