feat:step3:scrollview
This commit is contained in:
@@ -35,12 +35,16 @@ - (instancetype)init {
|
||||
|
||||
- (CGSize)sizeThatFits:(CGSize)size {
|
||||
if (self.contentView) {
|
||||
CGSize childSize = [self.contentView sizeThatFits:size];
|
||||
return CGSizeMake(MIN(size.width, childSize.width), MIN(size.height, childSize.height));
|
||||
return [self.contentView measureSize:size];
|
||||
}
|
||||
return CGSizeZero;
|
||||
}
|
||||
|
||||
- (void)layoutSelf:(CGSize)targetSize {
|
||||
[super layoutSelf:targetSize];
|
||||
[self.contentView layoutSelf:targetSize];
|
||||
}
|
||||
|
||||
- (void)setContentView:(UIView *)contentView {
|
||||
if (_contentView) {
|
||||
[_contentView removeFromSuperview];
|
||||
@@ -58,9 +62,6 @@ - (void)setHeaderView:(UIView *)headerView {
|
||||
self.refreshable = YES;
|
||||
}
|
||||
|
||||
- (void)layoutSubviews {
|
||||
[super layoutSubviews];
|
||||
}
|
||||
|
||||
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate {
|
||||
if (-scrollView.contentOffset.y >= self.headerView.height) {
|
||||
|
Reference in New Issue
Block a user