开发者

UIPopover delegate issue

开发者 https://www.devze.com 2023-01-05 06:53 出处:网络
I am facing one issue regarding the UIPopoverController. When I execute follo开发者_开发问答wing

I am facing one issue regarding the UIPopoverController. When I execute follo开发者_开发问答wing

- (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.


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!

0

精彩评论

暂无评论...
验证码 换一张
取 消