I have two tableviews, let´s say one and two, and one presents two when a textfield is tapped, and for this i have:
-(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];
}
Everything works great until know, table "two" appears inside the popover and underneath the textfield, but table "two" has a cancel button that it is supposed to dismiss tableview "two"(inside tableview "one"). So i went to my cancel method in tableview "two" and i did this but it isn´t working and i don't think it can be simple has this:
- (IBAction)cancel:(id)sender
{
[self removeFromParentViewController];
}
I also tried:
- (IBAction)cancel:(id)sender
{
one *aux = [[one alloc]init];
[aux.popover dismissPopoverAnimated:YES] //popover is a property of tableview one.
}
also tried: "if self isBeingPresented"...and nothing is working!.
Any ideas? help!
thanks in advance