Skip to content

Commit

Permalink
修复切换tab栏时,header没有重置位置的bug (#1271)
Browse files Browse the repository at this point in the history
- recovery for changing view state
  • Loading branch information
kinarobin authored and wolfcon committed May 6, 2019
1 parent 44abf07 commit d63c540
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions MJRefresh/Base/MJRefreshHeader.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ - (void)placeSubviews
self.mj_y = - self.mj_h - self.ignoredScrollViewContentInsetTop;
}

- (void)willMoveToWindow:(UIWindow *)newWindow {

if (!newWindow && self.isRefreshing) {
[self endRefreshing];
}
}

- (void)scrollViewContentOffsetDidChange:(NSDictionary *)change
{
[super scrollViewContentOffsetDidChange:change];
Expand Down

8 comments on commit d63c540

@JoinPerson
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果当前tabA出于刷新状态,然后你切换tab到tabB页面正好此时网络比较弱的情况下tabA界面的数据仍然没有加载出来如果我再切换到tabA界面此时应该是出于刷新状态(正常情况下),上面这样修改之后手动结束了刷新状态是不是有问题?

@wolfcon
Copy link
Collaborator

@wolfcon wolfcon commented on d63c540 May 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#1283 你试试这个 PR
@JoinPerson

@JoinPerson
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

修复切换tab栏时,header没有重置位置的bug 这个bug只会在iOS >= 11.0才会出现么?

@JoinPerson
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

调整后的代码好像只针对self.window == nil 且 iOS >= 11.0做了代码执行逻辑调整。

@JoinPerson
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

如果只是self.window == nil 且 iOS >= 11.0才出现这个bug 这样调整代码后,当 self.window == nil 且 iOS >= 11.0时会执行后面的代码(原来的逻辑是不会执行的)会不会带来新的问题?

@JoinPerson
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (self.window == nil) return; 这行代码是不是去掉就行了 不管这个条件成不成立都执行后面的代码会有问题么?

@wolfcon
Copy link
Collaborator

@wolfcon wolfcon commented on d63c540 May 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

有写注释的啊. iOS 10 之前的版本有影响.

@wolfcon
Copy link
Collaborator

@wolfcon wolfcon commented on d63c540 May 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS < 11 和 > 11 有不同的顶部栏 滞留 bug. 不是同一个.
但都出在这句上.

Please sign in to comment.