Jeevanantham
Jeevanantham

Reputation: 1

ipad UIPopoverController

how to place the arrow of UIPopoverController, over UITableView's selected cell

Upvotes: 0

Views: 4081

Answers (3)

Romeo
Romeo

Reputation: 31

Try getting the CGRect for the selected row using the following method.

CGRect selectedRect = [self.tableView rectForRowAtIndexPath:indexPath];

Then use the rect when you present the UIPopoverController:

[myPopover presentPopoverFromRect:selectedRect .............inView:self.view permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];

Upvotes: 3

BigSprocket
BigSprocket

Reputation: 166

You get to define the CGRect to which you want the popover to point.

CGPoint point = ...; // where they tapped on screen, taken from UIEvent, if you like
CGSize size = ...; // give a size range, maybe the size of your table cell
[popover presentPopoverFromRect:CGRectMake(point.x, point.y, size.width, size.height) 
inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];

Upvotes: 5

Jasarien
Jasarien

Reputation: 58478

I believe the arrow is placed automatically by the popover view itself. So whatever you set the frame of the popover to be, it'll draw its arrow top and center.

Upvotes: 1

Related Questions