UIProgressView 自定义高度问题
2021-06-23 本文已影响0人
YannChee
@interface LDProgressView : UIProgressView
@property(nonatomic, assign) CGFloat customHeight;
@end
@implementation LDProgressView
- (void)setFrame:(CGRect)frame {
[super setFrame:frame];
_customHeight = frame.size.height;
}
- (void)setCustomHeight:(CGFloat)customHeight {
_customHeight = customHeight;
[self setNeedsLayout];
[self layoutIfNeeded];
}
- (CGSize)sizeThatFits:(CGSize)size {
CGSize superSize = [super sizeThatFits:size];
return CGSizeMake(superSize.width, self.customHeight);
}
@end