Commit 5671f85d49190053eb673ed6f661682cc90aa8c9

Authored by zhangxiaowen
1 parent 9306ddb7

no message

CNLiveCollectionModule/Classes/Controller/CNLiveCollectionController.m
... ... @@ -24,7 +24,7 @@
24 24 #import "CNLiveCollectionModel.h"
25 25  
26 26  
27   -@interface CNLiveCollectionController ()<UITableViewDelegate, UITableViewDataSource,QMUIAlertControllerDelegate,CNLiveCollectionNavigationBarDelegate>
  27 +@interface CNLiveCollectionController ()<UITableViewDelegate, UITableViewDataSource,CNLiveCollectionNavigationBarDelegate>
28 28 @property (nonatomic, strong) CNLiveCollectionNavigationBar *navigationBar;
29 29 @property (nonatomic, strong) UITableView *tableView;
30 30 @property (nonatomic, strong) NSMutableArray *data;
... ... @@ -89,6 +89,7 @@
89 89 }];
90 90  
91 91 }
  92 +
92 93 - (void)loadMoreData{
93 94 if(!_isRefreshing){
94 95 _isRefreshing = YES;
... ... @@ -163,61 +164,6 @@
163 164 if ([actionEvents isEqualToString:@"1"]) {
164 165 [self goBack];
165 166 }
166   - else if ([actionEvents isEqualToString:@"2"]){
167   - self.navigationBar.right.userInteractionEnabled = NO;
168   - __weak typeof(self) weakSelf = self;
169   - QMUIAlertAction *action1 = [QMUIAlertAction actionWithTitle:@"保存图片" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
170   - __strong typeof(weakSelf) strongSelf = weakSelf;
171   - if(!strongSelf) return ;
172   -
173   - self.navigationBar.right.userInteractionEnabled = YES;
174   -
175   - }];
176   - QMUIAlertAction *action2 = [QMUIAlertAction actionWithTitle:@"扫描二维码" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
177   - __strong typeof(weakSelf) strongSelf = weakSelf;
178   - if(!strongSelf) return ;
179   -
180   - self.navigationBar.right.userInteractionEnabled = YES;
181   - }];
182   - QMUIAlertAction *action3 = [QMUIAlertAction actionWithTitle:@"重置二维码" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
183   - __strong typeof(weakSelf) strongSelf = weakSelf;
184   - if(!strongSelf) return ;
185   -
186   - self.navigationBar.right.userInteractionEnabled = YES;
187   -
188   - }];
189   - QMUIAlertAction *cancel = [QMUIAlertAction actionWithTitle:@"取消" style:QMUIAlertActionStyleCancel handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
190   - __strong typeof(weakSelf) strongSelf = weakSelf;
191   - if(!strongSelf) return ;
192   - self.navigationBar.right.userInteractionEnabled = YES;
193   -
194   - }];
195   -
196   - QMUIAlertController *alertController = [QMUIAlertController alertControllerWithTitle:@"" message:@"" preferredStyle:QMUIAlertControllerStyleActionSheet];
197   - alertController.delegate = self;
198   - [alertController addAction:action1];
199   - [alertController addAction:action2];
200   - [alertController addAction:action3];
201   - [alertController addAction:cancel];
202   -
203   - NSMutableDictionary *titleAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
204   -
205   - titleAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
206   -
207   - NSMutableDictionary *cancelAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
208   - cancelAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0];
209   -
210   - action1.buttonAttributes = titleAttributs;
211   - action2.buttonAttributes = titleAttributs;
212   - action3.buttonAttributes = titleAttributs;
213   - cancel.buttonAttributes = cancelAttributs;
214   -
215   - [alertController showWithAnimated:YES];
216   - }
217   -}
218   -- (void)didHideAlertController:(QMUIAlertController *)alertController{
219   - self.navigationBar.right.userInteractionEnabled = YES;
220   -
221 167 }
222 168  
223 169 #pragma mark - 懒加载
... ...
CNLiveCollectionModule/Classes/View/CNLiveCollectionCell.m
... ... @@ -44,6 +44,9 @@ static const NSInteger margin = 10;
44 44 [self.contentView addSubview:self.titleLabel];
45 45 [self.contentView addSubview:self.timeLabel];
46 46 [self.contentView addSubview:self.playerBtn];
  47 + UILongPressGestureRecognizer * longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressToDo:)];
  48 + longPress.minimumPressDuration = 1.0;
  49 + [self.contentView addGestureRecognizer:longPress];
47 50  
48 51 }
49 52 - (void)layoutSubviews{
... ... @@ -113,6 +116,40 @@ static const NSInteger margin = 10;
113 116 - (void)playerDidClicked:(UIButton *)btn{
114 117  
115 118 }
  119 +#pragma mark - 长按手势
  120 +- (void)longPressToDo:(UILongPressGestureRecognizer *)gesture {
  121 + //直接return掉,不在开始的状态里面添加任何操作,则长按手势就会被少调用一次了
  122 + if(gesture.state != UIGestureRecognizerStateBegan){
  123 + return;
  124 + }
  125 + __weak typeof(self) weakSelf = self;
  126 + QMUIAlertAction *action = [QMUIAlertAction actionWithTitle:@"取消收藏" style:QMUIAlertActionStyleDefault handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  127 + __strong typeof(weakSelf) strongSelf = weakSelf;
  128 + if(!strongSelf) return ;
  129 +
  130 + }];
  131 + QMUIAlertAction *cancel = [QMUIAlertAction actionWithTitle:@"取消" style:QMUIAlertActionStyleCancel handler:^(__kindof QMUIAlertController *aAlertController, QMUIAlertAction *action) {
  132 + __strong typeof(weakSelf) strongSelf = weakSelf;
  133 + if(!strongSelf) return ;
  134 +
  135 + }];
  136 +
  137 + QMUIAlertController *alertController = [QMUIAlertController alertControllerWithTitle:@"" message:@"" preferredStyle:QMUIAlertControllerStyleActionSheet];
  138 + [alertController addAction:action];
  139 + [alertController addAction:cancel];
  140 +
  141 + NSMutableDictionary *titleAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
  142 +
  143 + titleAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:35/255.0 green:212/255.0 blue:30/255.0 alpha:1.0];
  144 +
  145 + NSMutableDictionary *cancelAttributs = [[NSMutableDictionary alloc] initWithDictionary:alertController.alertTitleAttributes];
  146 + cancelAttributs[NSForegroundColorAttributeName] = [UIColor colorWithRed:51/255.0 green:51/255.0 blue:51/255.0 alpha:1.0];
  147 +
  148 + action.buttonAttributes = titleAttributs;
  149 + cancel.buttonAttributes = cancelAttributs;
  150 +
  151 + [alertController showWithAnimated:YES];
  152 +}
116 153  
117 154 #pragma mark - 懒加载
118 155 - (UIView *)bgView {
... ... @@ -144,10 +181,8 @@ static const NSInteger margin = 10;
144 181 _titleLabel.textAlignment = NSTextAlignmentLeft;
145 182 _titleLabel.numberOfLines = 0;
146 183 _titleLabel.lineBreakMode = NSLineBreakByTruncatingTail;
147   -
148 184 }
149 185 return _titleLabel;
150   -
151 186 }
152 187 - (UILabel *)timeLabel{
153 188 if(_timeLabel == nil){
... ... @@ -155,10 +190,8 @@ static const NSInteger margin = 10;
155 190 _timeLabel.textColor = [UIColor colorWithRed:155/255.0 green:155/255.0 blue:155/255.0 alpha:1.0];
156 191 _timeLabel.font = UIFontCNMake(13);
157 192 _timeLabel.userInteractionEnabled = YES;
158   -
159 193 }
160 194 return _timeLabel;
161   -
162 195 }
163 196 - (UIButton *)playerBtn {
164 197 if (!_playerBtn) {
... ...