我在UITableViewCell
内有UIButton
。当用户触摸单元格的按钮时,我想要显示指向该按钮的UIPopoverController
。UIPopOverController指向一个UITableViewCell内的对象?
目前,我在小区的委托下面的代码(委托是拥有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)];
}
有了这个代码,弹出了总是在的顶部指向查看,因为按钮的y位置与其单元相关。
我的问题是,我怎么能知道按钮的绝对位置,以指向它?有什么方法可以解决吗?
谢谢,这是正确的答案。 – 2011-12-30 11:47:17
当答案完全正确的时候就喜欢它,谢谢! – Tim 2012-02-06 12:02:57
@Tim,您随时欢迎您! – Ilanchezhian 2012-02-06 12:05:35