Hi friends,
On clicking the toolbar button, my popover view appears. When i rotate the simulator to landscape orientation , following error message is displayed :
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIPopoverController presentPopoverFromRect:inView:permittedArrowDirections:animated:]: Popovers cannot be presented from a view which does not have a window.'
*** First throw call stack:
(0x1b69052 0x1868d0a 0x1b11a78 0x1b119e9 0x9ae72e 0x9affcb 0x9b26eb 0x281a39 0x1b34885 0x1b347a8 0x1c61aa 0x5490d8 0x54d499 0x54d584 0x11ede00 0x15ff4f0 0x1aa0833 0x1a9fdb4 0x1a9fccb 0x209a879 0x209a93e 0x51ca9b 0x29dd 0x2955)
Code to handle my button event is :
-(IBAction)name:(id)sender
{
if ([_popover isPopoverVisible])
{
[_popover dismissPopoverAnimated:YES];
}
else {
task * content = [[task alloc] init];
content.navigationItem.title =@"name";
[content setDelegate:self];
navController = [[UINavigationController alloc] initWithRootViewController: content];
_popover = [[UIPopoverController alloc]
initWithContentViewController:navController];
_popover. popoverContentSize=CGSizeMake(350, 480);
[_popover presentPopoverFromBarButtonItem:sender
permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}
}
Thanks..