fix refresh issue
This commit is contained in:
parent
15bd513774
commit
c41c5bd3ad
|
|
@ -15,6 +15,7 @@
|
|||
@interface TLYShyScrollViewController : NSObject <TLYShyChild>
|
||||
|
||||
@property (nonatomic, weak) UIScrollView *scrollView;
|
||||
@property (nonatomic, weak) UIRefreshControl *refreshControl;
|
||||
@property (nonatomic, weak) TLYShyViewController *parent;
|
||||
|
||||
- (CGFloat)updateLayoutIfNeeded;
|
||||
|
|
|
|||
|
|
@ -19,10 +19,10 @@
|
|||
|
||||
- (CGFloat)updateLayoutIfNeeded
|
||||
{
|
||||
if ((self.scrollView.contentSize.height < FLT_EPSILON
|
||||
if (self.scrollView.contentSize.height < FLT_EPSILON
|
||||
&& ([self.scrollView isKindOfClass:[UITableView class]]
|
||||
|| [self.scrollView isKindOfClass:[UICollectionView class]])
|
||||
) || (self.scrollView.contentOffset.y <= -64))
|
||||
)
|
||||
{
|
||||
return 0.f;
|
||||
}
|
||||
|
|
@ -35,7 +35,10 @@
|
|||
if (normalizedY > -FLT_EPSILON && !UIEdgeInsetsEqualToEdgeInsets(insets, self.scrollView.contentInset))
|
||||
{
|
||||
CGFloat delta = insets.top - self.scrollView.contentInset.top;
|
||||
[self.scrollView tly_setInsets:insets];
|
||||
|
||||
if (self.refreshControl == nil || [self.refreshControl isHidden]) {
|
||||
[self.scrollView tly_setInsets:insets];
|
||||
}
|
||||
|
||||
return delta;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -152,6 +152,13 @@ static void * const kTLYShyNavBarManagerKVOContext = (void*)&kTLYShyNavBarManage
|
|||
_scrollView = scrollView;
|
||||
self.scrollViewController.scrollView = scrollView;
|
||||
|
||||
NSUInteger index = [scrollView.subviews indexOfObjectPassingTest:^BOOL (id obj, NSUInteger idx, BOOL *stop) {
|
||||
return [obj isKindOfClass:[UIRefreshControl class]];
|
||||
}];
|
||||
if (index != NSNotFound) {
|
||||
self.scrollViewController.refreshControl = [scrollView.subviews objectAtIndex:index];
|
||||
}
|
||||
|
||||
if (_scrollView.delegate != self.delegateProxy)
|
||||
{
|
||||
self.delegateProxy.originalDelegate = _scrollView.delegate;
|
||||
|
|
|
|||
Loading…
Reference in New Issue