CommonHomeVC.m 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  1. //
  2. // CommonHomeVC.m
  3. // smartRhino
  4. //
  5. // Created by niuzhen on 2020/4/28.
  6. // Copyright © 2020 tederen. All rights reserved.
  7. //
  8. #import "CommonHomeVC.h"
  9. #import "CommonListCell.h"
  10. #import "MyTDGroupView.h"
  11. #import "GHRefreshCollectionView.h"
  12. #import "CommonBarCell.h"
  13. #import "CommonBarModel.h"
  14. #import "CommonWorkVC.h"
  15. #import "CommonToolVC.h"
  16. #import "MyFavoriteVC.h"
  17. #import "CommonNoteVC.h"
  18. #import "ChatMsgListCell.h"
  19. #import "ChatMsgCollectionCell.h"
  20. @interface CommonHomeVC ()<UITableViewDelegate,UITableViewDataSource,UICollectionViewDelegate,UICollectionViewDataSource>
  21. @property (weak, nonatomic) IBOutlet UIView *NavBar;
  22. @property (strong, nonatomic) UIView *HeadView;
  23. @property (strong, nonatomic) UITableView *tableView;
  24. @property (strong, nonatomic) MyTDGroupView *SearchView;
  25. @property (strong, nonatomic) GHRefreshCollectionView *collectionView;
  26. @property (strong, nonatomic) NSMutableArray *collectionDataSource;
  27. @property (strong, nonatomic) NSMutableArray *dataArray;
  28. @property (nonatomic,assign) NSInteger currentPage;
  29. @property (nonatomic,assign) NSInteger totalPage;
  30. @end
  31. @implementation CommonHomeVC
  32. - (UIView *)HeadView
  33. {
  34. if (!_HeadView) {
  35. _HeadView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 46)];
  36. _HeadView.backgroundColor = [UIColor whiteColor];
  37. }
  38. return _HeadView;
  39. }
  40. - (void)setTableRefresh
  41. {
  42. WS(weakSelf);
  43. self.tableView.mj_header = [MJRefreshNormalHeader headerWithRefreshingBlock:^{
  44. [weakSelf headRefresh];
  45. }];
  46. self.tableView.mj_footer = [MJRefreshAutoNormalFooter footerWithRefreshingBlock:^{
  47. [weakSelf footerRefresh];
  48. }];
  49. [self.tableView.mj_header beginRefreshing];
  50. }
  51. - (void)headRefresh{
  52. self.currentPage = 1;
  53. self.totalPage = 1;
  54. [self.dataArray removeAllObjects];
  55. [self getDataList];
  56. }
  57. - (void)footerRefresh{
  58. self.currentPage += 1;
  59. if (self.totalPage == self.dataArray.count) {
  60. self.currentPage --;
  61. [self.tableView.mj_footer resetNoMoreData];
  62. return ;
  63. }
  64. [self getDataList];
  65. }
  66. - (void)viewWillAppear:(BOOL)animated
  67. {
  68. [super viewWillAppear:animated];
  69. [self setTableRefresh];
  70. }
  71. - (void)viewDidLoad {
  72. [super viewDidLoad];
  73. [self setTableRefresh];
  74. self.fd_prefersNavigationBarHidden = YES;
  75. self.view.backgroundColor = UIColorHex(0xffffff);
  76. self.tableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
  77. [self.HeadView addSubview:self.SearchView];
  78. [self.SearchView mas_makeConstraints:^(MASConstraintMaker *make) {
  79. make.top.mas_offset(5);
  80. make.left.right.mas_equalTo(self.HeadView);
  81. make.height.mas_offset(36);
  82. }];
  83. [self.view addSubview:self.tableView];
  84. [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  85. make.left.right.mas_equalTo(self.view);
  86. make.top.mas_equalTo(self.NavBar.mas_bottom);
  87. if (@available(iOS 11.0, *)) {
  88. make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom);
  89. } else {
  90. make.bottom.equalTo(self.view.mas_bottom);
  91. }
  92. }];
  93. self.tableView.tableHeaderView = self.HeadView;
  94. [self setBarData];
  95. [self.SearchView.button setAction:^{
  96. NSLog(@"点击搜索");
  97. }];
  98. self.tableView.delegate = self;
  99. self.tableView.dataSource = self;
  100. self.tableView.backgroundColor = [UIColor clearColor];
  101. }
  102. - (void)getDataList {
  103. WS(weakSelf);
  104. SHOWLOADING
  105. [[HttpManager sharedHttpManager] POSTUrl:Host(API_Collection_List) parameters:@{@"FolderId":@(0),@"Page":@(self.currentPage),@"PerPage":@(20),@"VisitUserId":@(0)} responseStyle:JOSN success:^(id _Nonnull responseObject) {
  106. REMOVESHOW
  107. [weakSelf.tableView.mj_header endRefreshing];
  108. [weakSelf.tableView.mj_footer endRefreshing];
  109. MyFavoriteModel *listModel = [[MyFavoriteModel alloc] initWithDictionary:responseObject error:nil];
  110. weakSelf.totalPage = listModel.Total;
  111. [weakSelf.dataArray addObjectsFromArray:listModel.Items];
  112. for (MyFavoriteSubModel *model in weakSelf.dataArray) {
  113. if (model.CollectionType == CollectModel_Text) {
  114. model.CollectionType = CollectModel_Aritle;
  115. }
  116. if (model.CollectionType == CollectModel_meet) {
  117. model.CollectionType = CollectModel_meetMian;
  118. }
  119. }
  120. [weakSelf changeMessageStatusWithNumber:weakSelf.dataArray.count];
  121. dispatch_async(dispatch_get_main_queue(), ^{
  122. if (weakSelf.totalPage < 20) {
  123. [weakSelf.tableView.mj_footer resetNoMoreData];
  124. [weakSelf.tableView.mj_footer setHidden:YES];
  125. }
  126. [weakSelf.tableView reloadData];
  127. });
  128. } failure:^(NSError * _Nonnull error) {
  129. REMOVESHOW
  130. [weakSelf.tableView.mj_header endRefreshing];
  131. [weakSelf.tableView.mj_footer endRefreshing];
  132. }];
  133. }
  134. - (BOOL)hidesBottomBarWhenPushed{
  135. return NO;
  136. }
  137. #pragma mark - UITableViewDelegate
  138. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  139. return 2;
  140. }
  141. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  142. switch (section) {
  143. case 0:{
  144. return 1;
  145. }break;
  146. default:{
  147. return self.dataArray.count;
  148. }break;
  149. }
  150. }
  151. - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
  152. switch (indexPath.section) {
  153. case 0:{
  154. return 74.f;
  155. }break;
  156. default:{
  157. return UITableViewAutomaticDimension;
  158. }break;
  159. }
  160. }
  161. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
  162. {
  163. switch (section) {
  164. case 0:{
  165. return 0.f;
  166. }break;
  167. default:{
  168. return 36.f;
  169. }break;
  170. }
  171. }
  172. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
  173. {
  174. switch (section) {
  175. case 0:{
  176. UIView * view = [UIView new];
  177. return view;
  178. }break;
  179. default:{
  180. UIView * view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 36)];
  181. view.backgroundColor = UIColorHex(0xF5F5F5);
  182. UILabel * label = [UILabel new];
  183. label.font = [UIFont systemFontOfSize:14];
  184. label.textColor = UIColorHex(0x888888);
  185. label.text = @"最新收藏";
  186. [view addSubview:label];
  187. [label mas_makeConstraints:^(MASConstraintMaker *make) {
  188. make.left.mas_offset(15);
  189. make.centerY.mas_equalTo(view);
  190. }];
  191. return view;
  192. }break;
  193. }
  194. }
  195. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  196. switch (indexPath.section) {
  197. case 0:
  198. {
  199. ChatMsgListCell *cell = [ChatMsgListCell configCell1:tableView indexPath:indexPath];
  200. [cell.cell1ContentBgView addSubview:self.collectionView];
  201. self.collectionView.frame = CGRectMake(0, 0, SCREEN_WIDTH, cell.cell1ContentBgView.height);
  202. [self.collectionView reloadData];
  203. return cell;
  204. }
  205. break;
  206. default:
  207. {
  208. CommonListCell *cell = [CommonListCell configCell1:tableView indexPath:indexPath];
  209. MyFavoriteSubModel * model = [self.dataArray objectAtIndex:indexPath.row];
  210. [cell setCell1Data:model];
  211. return cell;
  212. }
  213. break;
  214. }
  215. }
  216. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  217. [tableView deselectRowAtIndexPath:indexPath animated:YES];
  218. }
  219. #pragma mark - load
  220. - (UITableView *)tableView
  221. {
  222. if (!_tableView) {
  223. _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain];
  224. _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
  225. }
  226. return _tableView;
  227. }
  228. - (MyTDGroupView *)SearchView
  229. {
  230. if (!_SearchView) {
  231. _SearchView = [[MyTDGroupView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 36)];
  232. }
  233. return _SearchView;
  234. }
  235. -(NSMutableArray *)dataArray{
  236. if(!_dataArray){
  237. _dataArray = [[NSMutableArray alloc] init];
  238. }
  239. return _dataArray;
  240. }
  241. -(NSMutableArray *)collectionDataSource{
  242. if(!_collectionDataSource){
  243. _collectionDataSource = [[NSMutableArray alloc] init];
  244. }
  245. return _collectionDataSource;
  246. }
  247. - (GHRefreshCollectionView *)collectionView {
  248. if (!_collectionView) {
  249. UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
  250. layout.scrollDirection = UICollectionViewScrollDirectionHorizontal;
  251. layout.sectionInset = UIEdgeInsetsMake(0, 0, 0, 0);
  252. _collectionView = [[GHRefreshCollectionView alloc] initWithFrame:CGRectZero collectionViewLayout:layout];
  253. _collectionView.delegate = self;
  254. _collectionView.dataSource = self;
  255. _collectionView.showsHorizontalScrollIndicator = NO;
  256. [_collectionView registerNib:[UINib nibWithNibName:@"ChatMsgCollectionCell" bundle:nil] forCellWithReuseIdentifier:@"ChatMsgCollectionCell"];
  257. _collectionView.backgroundColor = [UIColor whiteColor];
  258. }
  259. return _collectionView;
  260. }
  261. #pragma mark UICollectionView
  262. - (NSInteger)numberOfSectionsInCollectionView:(GHRefreshCollectionView *)collectionView{
  263. return 1;
  264. }
  265. /**********************************************************************/
  266. #pragma mark -UICollectionViewDataSource
  267. /**********************************************************************/
  268. - (NSInteger)collectionView:(GHRefreshCollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
  269. return self.collectionDataSource.count;
  270. }
  271. - (UICollectionViewCell *)collectionView:(GHRefreshCollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
  272. {
  273. MoreAppInfoModel *bean = [self.collectionDataSource objectAtIndex:indexPath.item];
  274. ChatMsgCollectionCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"ChatMsgCollectionCell" forIndexPath:indexPath];
  275. cell.cell0IconImg.image = [UIImage imageNamed:bean.imgName];
  276. cell.cell0TitleLabel.text = bean.title;
  277. cell.imagH.constant = 25.f;
  278. cell.imagW.constant = 25.f;
  279. cell.titleConstant.constant = 8.f;
  280. switch (indexPath.item) {
  281. case 0:
  282. {
  283. cell.cell0ReadNumLabel.hidden = YES;
  284. NSString * count = @"0";
  285. cell.cell0ReadNumLabel.text = count;
  286. UILabel * label = [UILabel new];
  287. label.font = [UIFont systemFontOfSize:12];
  288. label.text = count;
  289. CGFloat width = [label sizeThatFits:CGSizeMake(SCREEN_WIDTH, 16)].width;
  290. if ((width + 5) < 16) {
  291. cell.constant.constant = 16;
  292. }else{
  293. cell.constant.constant = width + 8;
  294. }
  295. }
  296. break;
  297. case 1:
  298. {
  299. cell.cell0ReadNumLabel.hidden = YES;
  300. NSString * count = @"0";
  301. cell.cell0ReadNumLabel.text = count;
  302. UILabel * label = [UILabel new];
  303. label.font = [UIFont systemFontOfSize:12];
  304. label.text = count;
  305. CGFloat width = [label sizeThatFits:CGSizeMake(SCREEN_WIDTH, 16)].width;
  306. if ((width + 5) < 16) {
  307. cell.constant.constant = 16;
  308. }else{
  309. cell.constant.constant = width + 8;
  310. }
  311. }
  312. break;
  313. case 2:
  314. {
  315. cell.cell0ReadNumLabel.hidden = YES;
  316. NSString * count = @"0";
  317. cell.cell0ReadNumLabel.text = count;
  318. UILabel * label = [UILabel new];
  319. label.font = [UIFont systemFontOfSize:12];
  320. label.text = count;
  321. CGFloat width = [label sizeThatFits:CGSizeMake(SCREEN_WIDTH, 16)].width;
  322. if ((width + 5) < 16) {
  323. cell.constant.constant = 16;
  324. }else{
  325. cell.constant.constant = width + 8;
  326. }
  327. }
  328. break;
  329. case 3:
  330. {
  331. cell.cell0ReadNumLabel.hidden = YES;
  332. NSString * count = @"0";
  333. cell.cell0ReadNumLabel.text = count;
  334. UILabel * label = [UILabel new];
  335. label.font = [UIFont systemFontOfSize:12];
  336. label.text = count;
  337. CGFloat width = [label sizeThatFits:CGSizeMake(SCREEN_WIDTH, 16)].width;
  338. if ((width + 5) < 16) {
  339. cell.constant.constant = 16;
  340. }else{
  341. cell.constant.constant = width + 8;
  342. }
  343. }
  344. break;
  345. default:
  346. {
  347. cell.cell0ReadNumLabel.hidden = YES ;
  348. }
  349. break;
  350. }
  351. cell.cell0MengCengView.hidden = YES;
  352. return cell;
  353. }
  354. /****************************************************/
  355. #pragma mark --UICollectionViewDelegateFlowLayout
  356. /****************************************************/
  357. - (CGSize)collectionView:(GHRefreshCollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
  358. {
  359. CGFloat width = (SCREEN_WIDTH - 20) / self.collectionDataSource.count;
  360. CGFloat height = 80;
  361. return CGSizeMake(width, height);
  362. }
  363. -(UIEdgeInsets)collectionView:(GHRefreshCollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout insetForSectionAtIndex:(NSInteger)section
  364. {
  365. CGFloat W = 10;
  366. return UIEdgeInsetsMake(0,W,0,W);
  367. }
  368. - (CGFloat)collectionView:(GHRefreshCollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section{
  369. return 0;
  370. }
  371. - (CGFloat)collectionView:(GHRefreshCollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section{
  372. return 0;
  373. }
  374. - (void)collectionView:(GHRefreshCollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
  375. [collectionView deselectItemAtIndexPath:indexPath animated:YES];
  376. switch (indexPath.item) {
  377. case 0:
  378. {
  379. MyFavoriteVC *vc = [MyFavoriteVC initMyFavoriteVC];
  380. vc.listType = MyFavoriteListLevelTypeA;
  381. vc.FolderId = 0;
  382. vc.operationStateEnum = OperationStateEnum0;
  383. vc.myTitle = @"我的收藏";
  384. vc.hidesBottomBarWhenPushed = YES;
  385. [self.navigationController pushViewController:vc animated:YES];
  386. }
  387. break;
  388. case 1:
  389. {
  390. CommonNoteVC * vc = [CommonNoteVC initCommonNoteVC];
  391. vc.hidesBottomBarWhenPushed = YES;
  392. [self.navigationController pushViewController:vc animated:YES];
  393. }
  394. break;
  395. case 2:
  396. {
  397. CommonToolVC * vc = [CommonToolVC initCommonToolVC];
  398. vc.hidesBottomBarWhenPushed = YES;
  399. [self.navigationController pushViewController:vc animated:YES];
  400. }
  401. break;
  402. default:
  403. {
  404. CommonWorkVC * vc = [CommonWorkVC initCommonWorkVC];
  405. vc.hidesBottomBarWhenPushed = YES;
  406. [self.navigationController pushViewController:vc animated:YES];
  407. }
  408. break;
  409. }
  410. }
  411. - (void)setBarData
  412. {
  413. [self.collectionDataSource removeAllObjects];
  414. NSArray * titleArray = @[@"收藏",@"笔记",@"工具箱",@"工作台"];
  415. NSArray * imageArray = @[@"Common_collect",@"Common_note",@"Common_gjxiang",@"Common_gztai"];
  416. for (NSInteger i = 0; i < titleArray.count; i ++) {
  417. MoreAppInfoModel * model = [[MoreAppInfoModel alloc] init];
  418. model.title = titleArray[i];
  419. model.imgName = imageArray[i];
  420. [self.collectionDataSource addObject:model];
  421. }
  422. }
  423. #pragma Mark 左滑按钮 iOS8以上
  424. #if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_11_0
  425. - (nullable UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(tvos){
  426. if (indexPath.section == 0) {
  427. UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[]];
  428. actions.performsFirstActionWithFullSwipe = NO;
  429. return actions;
  430. }else{
  431. WEAKSELF
  432. UIContextualAction *action1 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"转发" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
  433. [tableView setEditing:NO animated:YES];
  434. }];
  435. action1.backgroundColor = UIColorHex(#FF923A);
  436. UIContextualAction *action2 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"置顶" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
  437. [tableView setEditing:NO animated:YES];
  438. }];
  439. action2.backgroundColor = UIColorHex(#9BA9CB);
  440. UIContextualAction *action3 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleNormal title:@"移动" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
  441. [tableView setEditing:NO animated:YES];
  442. }];
  443. action3.backgroundColor = UIColorHex(#589AF1);
  444. UIContextualAction *action4 = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive title:@"删除" handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
  445. [tableView setEditing:NO animated:YES];
  446. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
  447. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
  448. }];
  449. [ok setValue:k9 forKey:@"_titleTextColor"];
  450. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  451. }];
  452. [alertVC addAction:ok];
  453. [alertVC addAction:noOk];
  454. completionHandler(YES);
  455. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  456. }];
  457. action4.backgroundColor = UIColorHex(#F64A33);
  458. UISwipeActionsConfiguration *actions = [UISwipeActionsConfiguration configurationWithActions:@[action4,action3,action2,action1]];
  459. actions.performsFirstActionWithFullSwipe = NO;
  460. return actions;
  461. }
  462. }
  463. #else
  464. - (NSArray<UITableViewRowAction *> *)tableView:(UITableView *)tableView editActionsForRowAtIndexPath:(NSIndexPath *)indexPath {
  465. if (indexPath.section == 0) {
  466. return @[];
  467. }else{
  468. WEAKSELF
  469. UITableViewRowAction *action1 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"转发" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
  470. }];
  471. action1.backgroundColor = UIColorHex(#FF923A);
  472. UITableViewRowAction *action2 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"置顶" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
  473. }];
  474. action2.backgroundColor = UIColorHex(#9BA9CB);
  475. UITableViewRowAction *action3 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"移动" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
  476. }];
  477. action3.backgroundColor = UIColorHex(#589AF1);
  478. UITableViewRowAction *action4 = [UITableViewRowAction rowActionWithStyle:UITableViewRowActionStyleDestructive title:@"删除" handler:^(UITableViewRowAction * _Nonnull action, NSIndexPath * _Nonnull indexPath) {
  479. UIAlertController *alertVC = [UIAlertController alertControllerWithTitle:nil message:@"确认删除" preferredStyle:UIAlertControllerStyleAlert];
  480. UIAlertAction *ok = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  481. }];
  482. [ok setValue:k9 forKey:@"_titleTextColor"];
  483. UIAlertAction *noOk = [UIAlertAction actionWithTitle:@"确认" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
  484. }];
  485. [alertVC addAction:ok];
  486. [alertVC addAction:noOk];
  487. [weakSelf presentViewController:alertVC animated:YES completion:nil];
  488. }];
  489. action4.backgroundColor = UIColorHex(#F64A33);
  490. return @[action4, action3, action2,action1];
  491. }
  492. }
  493. #endif
  494. @end