1

I am using a table view controller in story board which contains a custom table view cell in which a 2 labels and one button is the elements. I need to get a ui popover with date picker when I click on button in custom table view cell. It is not possible to give a direct segue connection from cell to dateViewcontroller as popover.

Please suggest me some ideas.

if ([segue.identifier isEqualToString:@"segueToDate"])
{
    DatePickerViewController *dateVC = [[DatePickerViewController alloc] init];
    dateVC =[segue destinationViewController];
    dateVC.delegate = self;

    dateVC.pickerType = @"date";
   _popover = [[UIPopoverController alloc] initWithContentViewController:dateVC];
    _popover = [(UIStoryboardPopoverSegue *)segue popoverController];

    [_popover presentPopoverFromRect:selectedCell.checkboxBtn.frame inView:selectedCell permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];


    // [datePopover setDelegate:self];

}

error log is here:

* Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIPopoverController _commonPresentPopoverFromRect:inView:permittedArrowDirections:animated:]: Popovers cannot be presented from a view which does not have a window.'

Matthias
  • 3,582
  • 2
  • 30
  • 41
Priya
  • 25
  • 4
  • 3
    You must post error log alongwith question. – Tirth Jan 20 '14 at 05:58
  • /Priya xx/xx/xxxxx:1: Couldn't compile connection: => anchorView => > – Priya Jan 20 '14 at 06:35
  • Are you sure selectedCell is in memory or on the view? – Tirth Jan 20 '14 at 06:38
  • can u make it clear ? – Priya Jan 20 '14 at 06:46
  • 1
    "Popovers cannot be presented from a view which does not have a window" => it mean that your popup should be present on window or in window view hierarchy. So my point is "are you sure your selectedCell is in window view hierarchy?". – Tirth Jan 20 '14 at 06:51
  • yes, if u refer to the error i commented u may understand the problem i am facing. my scenario is i need a popover from a custom tableview cell in story board. what would u suggest – Priya Jan 20 '14 at 07:05
  • Where is selectedCell assigned? – valheru May 12 '14 at 01:14

0 Answers0