@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
网友评论