12345的789

UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.backView.bounds

                                                           byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight

                                                                 cornerRadii:CGSizeMake(12.f, 12.f)];

            CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];

            maskLayer.frame = self.backView.bounds;

            maskLayer.path = maskPath.CGPath;

            self.backView.layer.mask = maskLayer;

 

 

- (void)refreshBackgroundCornerRadius:(NSIndexPath *)indexPath {

    self.backView.layer.cornerRadius = 0;

    

    if (indexPath.section == 0) {

        if (indexPath.row == 3) {

            UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.backView.bounds

                                                           byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight

                                                                 cornerRadii:CGSizeMake(12.f, 12.f)];

            CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];

            maskLayer.frame = self.backView.bounds;

            maskLayer.path = maskPath.CGPath;

            self.backView.layer.mask = maskLayer;

            

        } else if (indexPath.row == 0) {

            UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.backView.bounds

                                                           byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight

                                                                 cornerRadii:CGSizeMake(12.f, 12.f)];

            CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];

            maskLayer.frame = self.backView.bounds;

            maskLayer.path = maskPath.CGPath;

            self.backView.layer.mask = maskLayer;

        } else {

            

        }

    }else if(indexPath.section == 1){

        if (indexPath.row == 1) {

            UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.backView.bounds

                                                           byRoundingCorners:UIRectCornerBottomLeft | UIRectCornerBottomRight

                                                                 cornerRadii:CGSizeMake(12.f, 12.f)];

            CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];

            maskLayer.frame = self.backView.bounds;

            maskLayer.path = maskPath.CGPath;

            self.backView.layer.mask = maskLayer;

            

        } else if (indexPath.row == 0) {

            UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.backView.bounds

                                                           byRoundingCorners:UIRectCornerTopLeft | UIRectCornerTopRight

                                                                 cornerRadii:CGSizeMake(12.f, 12.f)];

            CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];

            maskLayer.frame = self.backView.bounds;

            maskLayer.path = maskPath.CGPath;

            self.backView.layer.mask = maskLayer;

        } else {

            

        }

    }

}

 

 

 

 

 

 

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    YGProfileCell *profileCell = [tableView dequeueReusableCellWithIdentifier:YGMainProfileCellID];

    profileCell.backgroundColor = [UIColor clearColor];

    profileCell.selectionStyle = UITableViewCellSelectionStyleNone;

    

    [profileCell refreshProfileCell:self.profileDatas[indexPath.section][indexPath.row]];

    [profileCell refreshBackgroundCornerRadius:indexPath];

    

    return profileCell;

}

 

- (UITableView *)tableView {

    if ( !_tableView ) {

        _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];

        _tableView.backgroundColor = [UIColor clearColor];

        _tableView.bounces = NO;

        _tableView.delegate = self;

        _tableView.dataSource = self;

        _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;

        _tableView.showsVerticalScrollIndicator = NO;

        _tableView.sectionFooterHeight = 12;

        [_tableView registerClass:[YGProfileCell class] forCellReuseIdentifier:YGMainProfileCellID];

    }

    

    return _tableView;

}

 

#pragma mark - NSLog

#ifdef DEBUG

#define LCLog(fmt, ...) NSLog(@"%s [Line %d] %s\n", __FUNCTION__, __LINE__, [[NSString stringWithFormat:fmt, ## __VA_ARGS__] UTF8String]);

#else

#define LCLog(...)

#endif

NSStringFromSelector(_cmd)

 

#define ValidStr(str) ([str isKindOfClass:[NSString class]] && str.length ? str : @"")

#define ValidDic(dic) ([dic isKindOfClass:[NSDictionary class]] && dic ? dic : [NSDictionary dictionary])

#define ValidArr(arr) ([arr isKindOfClass:[NSArray class]] && arr ? arr : [NSArray array])

 

+ (BOOL)isIphoneXx{

    BOOL isIphoneXx = NO;

    if (@available(iOS 11.0, *)) {

        UIWindow *mainWindow = [UIApplication sharedApplication].windows.firstObject;

        if (mainWindow.safeAreaInsets.bottom > 0.f) {

            isIphoneXx = YES;

        }

    }

    return isIphoneXx;

}

 

posted @ 2021-03-03 00:21  象棋中的象棋  阅读(236)  评论(0编辑  收藏  举报