Commit 3dee27c9b582ed0bccafb8df828324db9311fb1e
1 parent
f45c8cea
0.5.1
Showing
4 changed files
with
16 additions
and
7 deletions
CNLiveVideoClassifyKit.podspec
| @@ -8,7 +8,7 @@ | @@ -8,7 +8,7 @@ | ||
| 8 | 8 | ||
| 9 | Pod::Spec.new do |s| | 9 | Pod::Spec.new do |s| |
| 10 | s.name = 'CNLiveVideoClassifyKit' | 10 | s.name = 'CNLiveVideoClassifyKit' |
| 11 | - s.version = '0.5.0' | 11 | + s.version = '0.5.1' |
| 12 | s.summary = '视讯头部一二级菜单组件' | 12 | s.summary = '视讯头部一二级菜单组件' |
| 13 | 13 | ||
| 14 | # This description is used to generate tags and improve search results. | 14 | # This description is used to generate tags and improve search results. |
CNLiveVideoClassifyKit/Classes/SearchView/ViewController/CNWitnessSearchDetailController.m
| @@ -117,13 +117,20 @@ static NSString *const CNWitnessSearchPersonCellID = @"CNWitnessSearchPersonCell | @@ -117,13 +117,20 @@ static NSString *const CNWitnessSearchPersonCellID = @"CNWitnessSearchPersonCell | ||
| 117 | - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer{ | 117 | - (BOOL)gestureRecognizerShouldBegin:(UIGestureRecognizer *)gestureRecognizer{ |
| 118 | return YES; | 118 | return YES; |
| 119 | } | 119 | } |
| 120 | -#pragma KVO||Notification | 120 | +#pragma mark - KVO||Notification |
| 121 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context{ | 121 | - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary<NSKeyValueChangeKey,id> *)change context:(void *)context{ |
| 122 | if ([keyPath isEqualToString:@"personMessage"]) { | 122 | if ([keyPath isEqualToString:@"personMessage"]) { |
| 123 | NSDictionary *dic = change[NSKeyValueChangeNewKey]; | 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 | [self.dataSource replaceObjectAtIndex:index withObject:model]; | 134 | [self.dataSource replaceObjectAtIndex:index withObject:model]; |
| 128 | [self.collectionView reloadItemsAtIndexPaths:@[[NSIndexPath indexPathForItem:index inSection:0]]]; | 135 | [self.collectionView reloadItemsAtIndexPaths:@[[NSIndexPath indexPathForItem:index inSection:0]]]; |
| 129 | } | 136 | } |
CNLiveVideoClassifyKit/Classes/SearchView/ViewController/CNWitnessSearchListController.m
| @@ -68,7 +68,8 @@ | @@ -68,7 +68,8 @@ | ||
| 68 | self.listContainerView.scrollView.offsetX = lenth; | 68 | self.listContainerView.scrollView.offsetX = lenth; |
| 69 | self.lineView.x = self.lineX + lenth/3; | 69 | self.lineView.x = self.lineX + lenth/3; |
| 70 | } else if (gesture.state == UIGestureRecognizerStateEnded) { | 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 | [self.myCategoryView selectItemAtIndex:1]; | 73 | [self.myCategoryView selectItemAtIndex:1]; |
| 73 | }else{ | 74 | }else{ |
| 74 | [self.listContainerView.scrollView setOffsetX:0 | 75 | [self.listContainerView.scrollView setOffsetX:0 |
CNLiveVideoClassifyKit/Classes/SearchView/ViewController/CNWitnessSearchViewController.m
| @@ -94,7 +94,8 @@ static NSString *const CNWitnessSearchHeaderViewID = @"CNWitnessSearchHeaderView | @@ -94,7 +94,8 @@ static NSString *const CNWitnessSearchHeaderViewID = @"CNWitnessSearchHeaderView | ||
| 94 | make.left.equalTo(self.view).offset(translation.x); | 94 | make.left.equalTo(self.view).offset(translation.x); |
| 95 | }]; | 95 | }]; |
| 96 | } else if (gesture.state == UIGestureRecognizerStateEnded) { | 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 | [self listViewShow:NO]; | 99 | [self listViewShow:NO]; |
| 99 | }else{ | 100 | }else{ |
| 100 | [self listViewShow:YES]; | 101 | [self listViewShow:YES]; |