Tutorial :UIPopover delegate issue



Question:

I am facing one issue regarding the UIPopoverController. When I execute following

- (void)showPopover:(id)sender   {          iPopOver = [[UIPopoverController alloc] initWithContentViewController:nav];           iPopOver.delegate = self;          [iPopOver presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];  }  

Application crashes and found this error

-[IPadController respondsToSelector:]: message sent to deallocated instance 0xc93b510

Not able to debug this behavior.


Solution:1

I think the sender argument is not a UIBarButtonItem or is an outdated reference.

You should replace your code with:

  [iPopOver presentPopoverFromBarButtonItem:myButton     permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];

where myButton is a reference to your UIBarButtonItem.

Good luck!


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »