美文网首页
iOS8.0以上cell中按钮点击效果

iOS8.0以上cell中按钮点击效果

作者: Roy_Liang | 来源:发表于2016-12-12 15:18 被阅读39次

Q:UITableView Cell中放入UIButton没有点击效果?

A: 如下~

// Set Cell Button highted cell上按钮点击效果
for (id view in self.tableView.subviews)
{
    // looking for a UITableViewWrapperView
    if ([NSStringFromClass([view class]) isEqualToString:@"UITableViewWrapperView"])
    {
        if([view isKindOfClass:[UIScrollView class]])
        {
            // turn OFF delaysContentTouches in the hidden subview
            UIScrollView *scroll = (UIScrollView *) view;
            scroll.delaysContentTouches = NO;
        }
        break;
    }
}

self.tableView.delaysContentTouches = NO;

相关文章

网友评论

      本文标题:iOS8.0以上cell中按钮点击效果

      本文链接:https://www.haomeiwen.com/subject/ugvmmttx.html