編寫cell中得button點(diǎn)擊事件
- (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); //擴(kuò)大熱區(qū)
//rect3就是最終結(jié)果。
}
新聞熱點(diǎn)
疑難解答
圖片精選
網(wǎng)友關(guān)注