34 lines
840 B
Objective-C
Executable File
34 lines
840 B
Objective-C
Executable File
//
|
|
// GKDYVideoItemButton.m
|
|
// GKDYVideo
|
|
//
|
|
// Created by QuintGao on 2023/3/22.
|
|
// Copyright © 2023 QuintGao. All rights reserved.
|
|
//
|
|
|
|
#import "GKDYVideoItemButton.h"
|
|
|
|
@implementation GKDYVideoItemButton
|
|
|
|
- (void)layoutSubviews {
|
|
[super layoutSubviews];
|
|
|
|
[self.imageView sizeToFit];
|
|
[self.titleLabel sizeToFit];
|
|
|
|
CGFloat width = self.frame.size.width;
|
|
CGFloat height = self.frame.size.height;
|
|
|
|
CGFloat imgW = self.imageView.frame.size.width;
|
|
CGFloat imgH = self.imageView.frame.size.height;
|
|
|
|
self.imageView.frame = CGRectMake((width - imgH) / 2, 0, imgW, imgH);
|
|
|
|
CGFloat titleW = self.titleLabel.frame.size.width;
|
|
CGFloat titleH = self.titleLabel.frame.size.height;
|
|
|
|
self.titleLabel.frame = CGRectMake((width - titleW) / 2, height - titleH, titleW, titleH);
|
|
}
|
|
|
|
@end
|