iOS - 版面实现记录二

版面二
图层

该版面基本实现思路与一中相似,但是 cell 结构有变化,如上图,imageView 被套在一个UIView 当中。
该 cell 实现代码:

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [UIColor clearColor];
        self.layer.cornerRadius = 15.f;


        UIView * backView = [[UIView alloc]initWithFrame:CGRectMake(5, 10, frame.size.width-10, frame.size.height * 0.8 - 10)];
        backView.layer.transform = CATransform3DMakeRotation(25, 0, 0, 1.0);
        backView.layer.cornerRadius = 15.f;
        backView.backgroundColor = [UIColor clearColor];
        backView.layer.masksToBounds = YES;
        [self addSubview:backView];

        self.imageView = [[EGOImageView alloc]init];
        [self.imageView setFrame:CGRectMake(0, 0, backView.frame.size.width * 1.2, backView.frame.size.height * 1.2)];
        self.imageView.layer.transform = CATransform3DMakeRotation(-25, 0, 0, 1.0);
        [self.imageView setCenter:CGPointMake(backView.center.x, backView.center.y - 15)];
        [self.imageView setBackgroundColor:[UIColor clearColor]];
        [backView addSubview:self.imageView];

        self.titleLabel = [[UILabel alloc]init];
        self.titleLabel.backgroundColor = LIGHT_GRAY;
        [self.titleLabel setFrame:CGRectMake(4.f,backView.frame.origin.y + backView.frame.size.height - 25, frame.size.width-8.f, frame.size.height * 0.3)];
        [self.titleLabel setTextAlignment:NSTextAlignmentCenter];
        [self addSubview:self.titleLabel];
    }
    return self;
}

@end

另外 cell 与 headView 中间的间隔使用
layout.sectionInset = UIEdgeInsetsMake(20, 0, 0, 0);

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值