工作中遇到的一些问题

记录一些在开发中遇到的问题以及问题解决的方法

1、 tableView的手势和tableView的子view上手势的冲突解决方案

- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer {
    if ([otherGestureRecognizer.view isKindOfClass:[UITableView class]]) {
        return YES;
    }
    return NO;
}
-(BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch {
    if ([NSStringFromClass([touch.view class]) isEqualToString:@"BJTSignView"]) {//判断如果点击的是tableView的cell,就把手势给关闭了
        return NO;//关闭手势
    }//否则手势存在
    return YES;
}

2、 在父view相应子view的事件

写在自定义的view中
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
{
    UIView *hitView = [super hitTest:point withEvent:event ];
    if (hitView == self)
    {
    //子view
        return self.scrollView;
    }
    else
    {
        return hitView;
    }

}

3、真机运行报错

问题显示截图
Verify the Developer App certificate for your account is trusted on your device. Open Settings on HHLM and navigate to General -> Device Management, then select your Developer App certificate to trust it.

解决方法:打开手机设置->通用->设备管理,找到编辑工程时的ID资料,点击允许即可

4、iOS11 UITableView group样式的时候设置headerView 会有多余的间隔

self.tableView.tableHeaderView = [[UIView alloc] init];

这样写会有多余的间隔,改成下面的就OK了 。因为设置是0的时候 UITableViewHeader高度就被设置成了默认值!

self.tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0,0,0,CGFLOAT_MIN)];
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容