فهرست منبع

Fix bug

Fix bug
M了个J 11 سال پیش
والد
کامیت
0ba6a99562

+ 3 - 3
MJRefreshExample/MJRefreshExample/MJRefresh/MJRefreshBaseView.m

@@ -96,9 +96,8 @@ - (void)willMoveToSuperview:(UIView *)newSuperview
 {
     [super willMoveToSuperview:newSuperview];
     
-    if (self.superview) { // 旧的父控件
-        [self.superview removeObserver:self forKeyPath:MJRefreshContentOffset context:nil];
-    }
+    // 旧的父控件
+    [self.superview removeObserver:self forKeyPath:MJRefreshContentOffset context:nil];
     
     if (newSuperview) { // 新的父控件
         [newSuperview addObserver:self forKeyPath:MJRefreshContentOffset options:NSKeyValueObservingOptionNew context:nil];
@@ -138,6 +137,7 @@ - (void)beginRefreshing
     } else {
 #warning 不能调用set方法
         _state = MJRefreshStateWillRefreshing;
+        [super setNeedsDisplay];
     }
 }
 

+ 2 - 3
MJRefreshExample/MJRefreshExample/MJRefresh/MJRefreshFooterView.m

@@ -33,9 +33,8 @@ - (void)willMoveToSuperview:(UIView *)newSuperview
 {
     [super willMoveToSuperview:newSuperview];
     
-    if (self.superview) { // 旧的父控件
-        [self.superview removeObserver:self forKeyPath:MJRefreshContentSize context:nil];
-    }
+    // 旧的父控件
+    [self.superview removeObserver:self forKeyPath:MJRefreshContentSize context:nil];
     
     if (newSuperview) { // 新的父控件
         // 监听

+ 1 - 0
MJRefreshExample/MJRefreshExample/MJRefresh/MJRefreshHeaderView.m

@@ -111,6 +111,7 @@ - (void)updateTimeLabel
     // 3.显示日期
     self.lastUpdateTimeLabel.text = [NSString stringWithFormat:@"最后更新:%@", time];
 }
+
 #pragma mark - 监听UIScrollView的contentOffset属性
 - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
 {