编写cell中得button点击事件

- (IBAction)showButtonClick:(id)sender

{

UIButton *button = (UIButton *)sender;

UIWindow* window = [UIApplication sharedApplication].keyWindow;

CGRect rect1 = [button convertRect:button.frame fromView:self.contentView];     //获取button在contentView的位置

CGRect rect2 = [button convertRect:rect1 toView:window];         //获取button在window的位置

CGRect rect3 = CGRectInset(rect2, -0.5 * 8, -0.5 * 8);          //扩大热区

//rect3就是最终结果。

}

04-17 02:47