I have a UIButton inside a UITableViewCell. When the user touches a cell’s button, I want to display a UIPopoverController pointing to the button.
At the moment I have the following code in the cell’s delegate (the delegate is the view controller that owns the UITableView):
-(void) onStatusButtonTouched:(UIButton *)aButton{
StatusPickerController *statusPicker = [[StatusPickerController alloc] init];
_popOver = nil;
_popOver = [[UIPopoverController alloc] initWithContentViewController:statusPicker];
[_popOver setDelegate:self];
[_popOver presentPopoverFromRect:aButton.frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];
[_popOver setPopoverContentSize:CGSizeMake(100, 352)];
}
With this code the pop over is always pointing at the top of the view, because the button’s y position is relative to its cell.
My question is, how can I know the button absolute position in order to point to it? Is there any method to work it out?
Instead of the following line
try the following line