Amit Battan
Amit Battan

Reputation: 3018

Crash on presentPopoverFromRect

I have subclass the UIButton

in the init method I added the target to button

[self addTarget:self action:@selector(openList:) forControlEvents:UIControlEventTouchUpInside];

in the openList

[listPopOver presentPopoverFromRect:self.frame
                          inView:self.superview
                          permittedArrowDirections:UIPopoverArrowDirectionUp
                          animated:YES];

but application on presentPopoverFromRect (EXC_BAD_ACCESS)

enter image description here

Upvotes: 1

Views: 1489

Answers (3)

rishi
rishi

Reputation: 11839

Enable NSZombie to check which exact instance is creating issue, it seems like there is some issue in table view.

Upvotes: 2

Denis Kulygin
Denis Kulygin

Reputation: 323

Error:

UIPopoverController* pop = [[UIPopoverController alloc] initWithContentViewController:[[UIViewController alloc] init]];
    [pop presentPopoverFromRect:[tableView cellForRowAtIndexPath:indexPath].frame inView:tableView permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

No error:

@property (strong, nonatomic) UIPopoverController* pop;
@synthesize pop = _pop;

pop = [[UIPopoverController alloc] initWithContentViewController:[[UIViewController alloc] init]];
    [pop presentPopoverFromRect:[tableView cellForRowAtIndexPath:indexPath].frame inView:tableView permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

Upvotes: 2

Rinju  Jain
Rinju Jain

Reputation: 1694

    if(![listPopOver isPopoverVisible]){

    listPopOver = [[listPopOverViewController alloc] initWithNibName:@"listPopOverViewController" bundle:nil];
    listPopOver.viewDelegate=self;
    listPopOver = [[[UIPopoverController alloc] initWithContentViewController:PopOver] retain];
    [listPopOver setPopoverContentSize:CGSizeMake(670.0f, 380.0f)];
    permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
    [listPopOver presentPopoverFromRect:CGRectMake(50, 160, 670, 380) inView:self.view permittedArrowDirections:0
                                     animated:YES]; 
    }
else{

    [listPopOver dismissPopoverAnimated:YES];
}

Upvotes: 0

Related Questions