Commit 3dee27c9b582ed0bccafb8df828324db9311fb1e
1 parent
f45c8cea
0.5.1
Showing
4 changed files
with
16 additions
and
7 deletions
CNLiveVideoClassifyKit.podspec
CNLiveVideoClassifyKit/Classes/SearchView/ViewController/CNWitnessSearchDetailController.m
| ... | ... | @@ -117,13 +117,20 @@ static NSString *const CNWitnessSearchPersonCellID = @"CNWitnessSearchPersonCell |
| 117 | 117 | - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer{ |
| 118 | 118 | return YES; |
| 119 | 119 | } |
| 120 | -#pragma KVO||Notification | |
| 120 | +#pragma mark - KVO||Notification | |
| 121 | 121 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context{ |
| 122 | 122 | if ([keyPath isEqualToString:@"personMessage"]) { |
| 123 | 123 | NSDictionary *dic = change[NSKeyValueChangeNewKey]; |
| 124 | - CNPersonMessageModel *model = [CNPersonMessageModel mj_objectWithKeyValues:dic]; | |
| 125 | - if ([self.personIDArray containsObject:model.id]) { | |
| 126 | - NSInteger index = [self.personIDArray indexOfObject:model.id]; | |
| 124 | + if ([self.personIDArray containsObject:dic[@"id"]]) { | |
| 125 | + NSInteger index = [self.personIDArray indexOfObject:dic[@"id"]]; | |
| 126 | + CNPersonMessageModel *model = self.dataSource[index]; | |
| 127 | + if ([dic[@"followStatus"] isEqualToString:@"0"] && model.focused) { | |
| 128 | + model.focused = NO; | |
| 129 | + model.fansNum -= 1; | |
| 130 | + }else if (([dic[@"followStatus"] isEqualToString:@"1"] ||[dic[@"followStatus"] isEqualToString:@"2"] )&& !model.focused){ | |
| 131 | + model.focused = YES; | |
| 132 | + model.fansNum += 1; | |
| 133 | + } | |
| 127 | 134 | [self.dataSource replaceObjectAtIndex:index withObject:model]; |
| 128 | 135 | [self.collectionView reloadItemsAtIndexPaths:@[[NSIndexPath indexPathForItem:index inSection:0]]]; |
| 129 | 136 | } | ... | ... |
CNLiveVideoClassifyKit/Classes/SearchView/ViewController/CNWitnessSearchListController.m
| ... | ... | @@ -68,7 +68,8 @@ |
| 68 | 68 | self.listContainerView.scrollView.offsetX = lenth; |
| 69 | 69 | self.lineView.x = self.lineX + lenth/3; |
| 70 | 70 | } else if (gesture.state == UIGestureRecognizerStateEnded) { |
| 71 | - if (lenth >= sensitivePosition || gesture.numberOfTouches < 0.5) { | |
| 71 | + CGPoint speed = [gesture velocityInView:gesture.view]; | |
| 72 | + if (lenth >= sensitivePosition || speed.x != 0) { | |
| 72 | 73 | [self.myCategoryView selectItemAtIndex:1]; |
| 73 | 74 | }else{ |
| 74 | 75 | [self.listContainerView.scrollView setOffsetX:0 | ... | ... |
CNLiveVideoClassifyKit/Classes/SearchView/ViewController/CNWitnessSearchViewController.m
| ... | ... | @@ -94,7 +94,8 @@ static NSString *const CNWitnessSearchHeaderViewID = @"CNWitnessSearchHeaderView |
| 94 | 94 | make.left.equalTo(self.view).offset(translation.x); |
| 95 | 95 | }]; |
| 96 | 96 | } else if (gesture.state == UIGestureRecognizerStateEnded) { |
| 97 | - if (translation.x >= sensitivePosition || gesture.numberOfTouches < 0.5) { | |
| 97 | + CGPoint speed = [gesture velocityInView:gesture.view]; | |
| 98 | + if (translation.x >= sensitivePosition || speed.x != 0) { | |
| 98 | 99 | [self listViewShow:NO]; |
| 99 | 100 | }else{ |
| 100 | 101 | [self listViewShow:YES]; | ... | ... |