自定義button imageview 和 titleLabel 位置 大小等

@implementation QTShareIPhoneButton

 

-(instancetype)initWithFrame:(CGRect)frame {

    self = [super initWithFrame:frame];

    if (self) {

        self.contentMode = UIViewContentModeScaleAspectFit;

    }

    return self;

}

 

-(void)layoutSubviews {

    [super layoutSubviews];

    CGRect imageRect = self.imageView.frame;

    imageRect.size = CGSizeMake(24, 24);

    imageRect.origin.x = [Utility margin];

    imageRect.origin.y = 12;

    CGRect titleRect = self.titleLabel.frame;

    

    

    titleRect.origin.x = 61;

    titleRect.origin.y = 12;

    titleRect.size = CGSizeMake(200, 24);

    self.imageView.frame = imageRect;

    self.titleLabel.frame = titleRect;

}

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章