0
点赞
收藏
分享

微信扫一扫

tabbar的优雅设计

凛冬已至夏日未远 2022-04-14 阅读 36
ios

- (void)layoutSubviews {

    [super layoutSubviews];

    self.label.mm_center();

    CGPoint center = self.label.center;

    center.x = self.bounds.size.width/2.0;

    center.y = self.bounds.size.height/2.0;

    self.label.center = center;

    self.layer.cornerRadius = 0.5 * self.bounds.size.height;

}

- (CGSize)sizeThatFits:(CGSize)size {

    [self.label sizeToFit];

    CGFloat width = self.label.bounds.size.width + 8;

    CGFloat height = self.label.bounds.size.height + 2;

    if (width < height) {

        width = height;

    }

    return CGSizeMake( width, height);

}

举报

相关推荐

0 条评论