FavoritesController.m 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499
  1. //
  2. // FavoritesController.m
  3. // AIIM
  4. //
  5. // Created by qitewei on 2025/4/29.
  6. //
  7. #import "FavoritesController.h"
  8. #import "FavoritesAudioCell.h"
  9. #import "FavoritesPictrueCell.h"
  10. #import "FavoritesTextCell.h"
  11. #import "UserNetApi.h"
  12. #import "FilePreviewer.h"
  13. #import "QuoteDetailController.h"
  14. #import "CryptoAES.h"
  15. #import "FileNetApi.h"
  16. #import "AVFoundation/AVFoundation.h"
  17. @interface FavoritesController ()<UITableViewDelegate,UITableViewDataSource>
  18. @property (nonatomic, strong) UIButton * rightBtn;
  19. @property (nonatomic, strong) UITextField * searchTextfield;
  20. @property (nonatomic, strong) UIStackView * buttonStackView;
  21. @property (nonatomic, strong) UIButton * allBtn;
  22. @property (nonatomic, strong) UIButton * textBtn;
  23. @property (nonatomic, strong) UIButton * pictrueBtn;
  24. @property (nonatomic, strong) UIButton * fileBtn;
  25. @property (nonatomic, strong) UIButton * audioBtn;
  26. @property (nonatomic, strong) UIView * bottomCube;
  27. @property (nonatomic, strong) UITableView * tableView;
  28. @property (nonatomic, strong) AVPlayer * player;
  29. @property (nonatomic, strong) NSMutableArray * dataArray;
  30. @end
  31. @implementation FavoritesController
  32. #pragma mark lifecircle
  33. - (void)viewDidLoad {
  34. [super viewDidLoad];
  35. [self configUI];
  36. [self getFavoritesWithType:@""];
  37. }
  38. #pragma mark UI
  39. - (void)configUI{
  40. [self setNavigationBarHidden:NO animated:YES];
  41. [self setNavigationTitle:NSLocalizedString(@"userCenter-shoucjia", @"")];
  42. // 设置导航栏背景色
  43. [self setNavigationBarBackgroundColor:UIColor.clearColor];
  44. [self setNavigationBarTransparent:YES];
  45. // 设置标题颜色和字体
  46. [self setNavigationTitleColor:[UIColor whiteColor] font:[UIFont boldSystemFontOfSize:18]];
  47. // 设置返回按钮
  48. [self setBackButtonTitle:@""];
  49. [self setBackButtonColor:[UIColor whiteColor]];
  50. // self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:self.rightBtn];
  51. // [self.view addSubview:self.searchTextfield];
  52. // [self.searchTextfield mas_makeConstraints:^(MASConstraintMaker *make) {
  53. // make.height.mas_equalTo(36);
  54. // make.top.mas_equalTo(SCREEN_TOP+10);
  55. // make.left.mas_equalTo(20);
  56. // make.right.mas_equalTo(-20);
  57. // }];
  58. UIImageView * bgImageView = [[UIImageView alloc] initWithImage:kImageMake(@"loginBG")];
  59. [self.view addSubview:bgImageView];
  60. [bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
  61. make.left.right.top.bottom.mas_equalTo(0);
  62. }];
  63. [self.view addSubview:self.buttonStackView];
  64. [self.buttonStackView mas_makeConstraints:^(MASConstraintMaker *make) {
  65. make.top.mas_equalTo(SCREEN_TOP+10);
  66. make.height.mas_equalTo(36);
  67. make.left.mas_equalTo(20);
  68. make.right.mas_equalTo(-20);
  69. }];
  70. [self.view addSubview:self.bottomCube];
  71. [self.bottomCube mas_makeConstraints:^(MASConstraintMaker *make) {
  72. make.size.mas_equalTo(CGSizeMake((SCREEN_WIDTH-40)/4, 4));
  73. make.top.mas_equalTo(self.buttonStackView.mas_bottom);
  74. make.centerX.mas_equalTo(self.allBtn.mas_centerX);
  75. }];
  76. [self.view addSubview:self.tableView];
  77. [self.tableView mas_makeConstraints:^(MASConstraintMaker *make) {
  78. make.bottom.left.right.mas_equalTo(0);
  79. make.top.mas_equalTo(self.bottomCube.mas_bottom).offset(5);
  80. }];
  81. }
  82. #pragma mark api
  83. - (void)getFavoritesWithType:(NSString *)type{
  84. [UserNetApi favoritesListWithType:type succ:^(int code, NSDictionary * _Nullable result) {
  85. if ([result jk_hasKey:@"code"] && [result[@"code"] isEqual:@200]) {
  86. NSLog(@"--------result:%@",result);
  87. NSArray * data = [self replaceNullsWithEmptyStringInArray:result[@"data"]];
  88. [self.dataArray removeAllObjects];
  89. [self.dataArray addObjectsFromArray:data];
  90. [self.tableView reloadData];
  91. }
  92. } fail:^(NSError * _Nonnull error) {
  93. NSLog(@"%@",error);
  94. }];
  95. }
  96. - (void)deleteFavoritesWithId:(NSString *)msgId{
  97. [UserNetApi deleteFavoritesWithId:msgId succ:^(int code, NSDictionary * _Nullable result) {
  98. if ([result jk_hasKey:@"code"] && [result[@"code"] isEqual:@200]) {
  99. [MBProgressHUD showWithText:result[@"msg"]];
  100. }
  101. } fail:^(NSError * _Nonnull error) {
  102. NSLog(@"error:%@",error);
  103. }];
  104. }
  105. #pragma mark event
  106. - (void)categoryButtonClicked:(UIButton *)sender{
  107. for (UIButton * button in @[self.allBtn,self.textBtn,self.pictrueBtn,self.fileBtn,self.audioBtn]) {
  108. if (button == sender) {
  109. button.selected = YES;
  110. }else{
  111. button.selected = NO;
  112. }
  113. }
  114. [self.bottomCube mas_remakeConstraints:^(MASConstraintMaker *make) {
  115. make.size.mas_equalTo(CGSizeMake((SCREEN_WIDTH-40)/4, 4));
  116. make.top.mas_equalTo(self.buttonStackView.mas_bottom);
  117. make.centerX.mas_equalTo(sender.mas_centerX);
  118. }];
  119. NSString * favoritesType;
  120. if (sender == self.allBtn) {
  121. favoritesType = @"";
  122. }else if (sender == self.textBtn){
  123. favoritesType = @"0";
  124. }else if (sender == self.pictrueBtn){
  125. favoritesType = @"1";
  126. }else if (sender == self.fileBtn){
  127. favoritesType = @"2";
  128. }else if (sender == self.audioBtn){
  129. favoritesType = @"3";
  130. }
  131. [self getFavoritesWithType:favoritesType];
  132. }
  133. #pragma mark private
  134. - (void)playerItemDidReachEnd:(NSNotification *)notification {
  135. // 播放结束时的处理代码
  136. NSLog(@"播放结束:%@",notification);
  137. [[UIDevice currentDevice] setProximityMonitoringEnabled:NO]; //建议在播放之前设置yes,播放结束设置NO。这个功能是开启红外感应
  138. [[NSNotificationCenter defaultCenter] removeObserver:self name:notification.name object:notification.object];
  139. //可以执行继续播放下一条操作
  140. }
  141. // 递归替换字典中的 NSNull 为 @""
  142. - (NSDictionary *)replaceNullsWithEmptyStringInDictionary:(NSDictionary *)dictionary {
  143. NSMutableDictionary *mutableDict = [NSMutableDictionary dictionaryWithDictionary:dictionary];
  144. for (id key in [mutableDict allKeys]) {
  145. id value = [mutableDict objectForKey:key];
  146. if ([value isKindOfClass:[NSNull class]]) {
  147. [mutableDict setObject:@"" forKey:key];
  148. } else if ([value isKindOfClass:[NSDictionary class]]) {
  149. // 递归处理子字典
  150. [mutableDict setObject:[self replaceNullsWithEmptyStringInDictionary:value] forKey:key];
  151. } else if ([value isKindOfClass:[NSArray class]]) {
  152. // 递归处理数组
  153. [mutableDict setObject:[self replaceNullsWithEmptyStringInArray:value] forKey:key];
  154. }
  155. }
  156. return [NSDictionary dictionaryWithDictionary:mutableDict];
  157. }
  158. // 递归替换数组中的 NSNull 为 @""
  159. - (NSArray *)replaceNullsWithEmptyStringInArray:(NSArray *)array {
  160. NSMutableArray *mutableArray = [NSMutableArray arrayWithArray:array];
  161. for (NSInteger i = 0; i < [mutableArray count]; i++) {
  162. id value = [mutableArray objectAtIndex:i];
  163. if ([value isKindOfClass:[NSNull class]]) {
  164. [mutableArray replaceObjectAtIndex:i withObject:@""];
  165. } else if ([value isKindOfClass:[NSDictionary class]]) {
  166. // 递归处理子字典
  167. [mutableArray replaceObjectAtIndex:i withObject:[self replaceNullsWithEmptyStringInDictionary:value]];
  168. } else if ([value isKindOfClass:[NSArray class]]) {
  169. // 递归处理子数组
  170. [mutableArray replaceObjectAtIndex:i withObject:[self replaceNullsWithEmptyStringInArray:value]];
  171. }
  172. }
  173. return [NSArray arrayWithArray:mutableArray];
  174. }
  175. #pragma mark tableView delegate
  176. - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
  177. return 1;
  178. }
  179. - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
  180. return self.dataArray.count;
  181. }
  182. - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
  183. return 0;
  184. }
  185. - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{
  186. return nil;
  187. }
  188. - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
  189. NSDictionary * dict = self.dataArray[indexPath.section];
  190. if ([dict[@"messageType"] isEqualToString:@"0"]) {
  191. //文本
  192. FavoritesTextCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass(FavoritesTextCell.class) forIndexPath:indexPath];
  193. [cell setMsg:dict];
  194. return cell;
  195. }
  196. if ([dict[@"messageType"] isEqualToString:@"1"]) {
  197. //图片
  198. FavoritesPictrueCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass(FavoritesPictrueCell.class) forIndexPath:indexPath];
  199. [cell setMsg:dict];
  200. return cell;
  201. }
  202. FavoritesAudioCell * cell = [tableView dequeueReusableCellWithIdentifier:NSStringFromClass(FavoritesAudioCell.class) forIndexPath:indexPath];
  203. [cell setMsg:dict];
  204. return cell;
  205. }
  206. - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
  207. NSDictionary * dict = self.dataArray[indexPath.section];
  208. NSString *extend = dict[@"extend"];
  209. NSData *data = [extend dataUsingEncoding:NSUTF8StringEncoding];
  210. NSError *error;
  211. NSDictionary *extendDict = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
  212. if ([dict[@"messageType"] isEqualToString:@"1"] || [dict[@"messageType"] isEqualToString:@"5"]) {
  213. NSLog(@"extendDict:%@",extendDict);
  214. if([extendDict jk_hasKey:@"url"]){
  215. [FilePreviewer.shared previewFileWithLocalPath:extendDict[@"localurl"]?:@"" remoteURL:getURL(extendDict[@"url"]) fromViewController:self];
  216. }else{
  217. [MBProgressHUD showWithText:NSLocalizedString(@"AppLock_fail", @"操作失败")];
  218. }
  219. }else if ([dict[@"messageType"] isEqualToString:@"0"]) {
  220. NSLog(@"dict:%@",dict);
  221. QuoteDetailController * quoteDetailVc = [[QuoteDetailController alloc] init];
  222. quoteDetailVc.quotedContent = [CryptoAES.shareInstance decryptDataL:dict[@"content"]];
  223. quoteDetailVc.quotedSenderName = dict[@"formName"];
  224. UINavigationController * navi = [[UINavigationController alloc] initWithRootViewController:quoteDetailVc];
  225. navi.modalPresentationStyle = UIModalPresentationFullScreen;
  226. [self presentViewController:navi animated:YES completion:nil];
  227. }else if ([dict[@"messageType"] isEqualToString:@"3"]) {
  228. //语音
  229. if (self.player) {
  230. AVPlayerItem *playerItem = self.player.currentItem;
  231. CMTime currentTime = playerItem.currentTime;
  232. CMTime duration = playerItem.duration;
  233. if (self.player.rate == 0.0) {
  234. if (CMTimeCompare(currentTime, duration) == 0 ||
  235. CMTimeCompare(currentTime, duration) == 1) {
  236. // 播放完毕
  237. NSLog(@"Playback finished");
  238. } else {
  239. // 暂停
  240. NSLog(@"Playback paused");
  241. [self.player play];
  242. return;
  243. }
  244. } else {
  245. // 正在播放
  246. NSLog(@"Playback in progress");
  247. [self.player pause];
  248. return;
  249. }
  250. }
  251. if([extendDict jk_hasKey:@"url"]){
  252. NSString *urlstr = extendDict[@"url"];
  253. AVAudioSession *audioSession = [AVAudioSession sharedInstance];
  254. [audioSession setCategory:AVAudioSessionCategoryPlayback error:nil];
  255. [audioSession setActive:YES error:nil];
  256. NSURL *Url = [NSURL URLWithString:urlstr];
  257. AVPlayerItem *pitem = [[AVPlayerItem alloc] initWithURL:Url];
  258. _player = [AVPlayer playerWithPlayerItem:pitem];
  259. [[UIDevice currentDevice] setProximityMonitoringEnabled:YES]; //建议在播放之前设置yes,播放结束设置NO。这个功能是开启红外感应
  260. [_player play];
  261. [[NSNotificationCenter defaultCenter] addObserver:self
  262. selector:@selector(playerItemDidReachEnd:)
  263. name:AVPlayerItemDidPlayToEndTimeNotification
  264. object:pitem];
  265. }
  266. }else if ([dict[@"messageType"] isEqualToString:@"5"]) {
  267. //文件(保存到本地)
  268. // [AlertHelper showAlertWithTitle:@"提示" message:[NSString stringWithFormat:@" 是否保存%@到本地",extendDict[@"fileName"]] cancelButtonTitle:@"取消" confirmButtonTitle:@"确定" completion:^(NSInteger buttonIndex) {
  269. // if (buttonIndex == 0) {
  270. //
  271. // }else{
  272. // [FileNetApi downLoadWToken:getURL(extendDict[@"url"]) succ:^(int code, NSDictionary * _Nullable result) {
  273. //
  274. // } fail:^(NSError * _Nonnull error) {
  275. //
  276. // }];
  277. // }
  278. // }];
  279. }
  280. }
  281. - (UISwipeActionsConfiguration *)tableView:(UITableView *)tableView trailingSwipeActionsConfigurationForRowAtIndexPath:(NSIndexPath *)indexPath {
  282. // 创建删除操作
  283. UIContextualAction *deleteAction = [UIContextualAction contextualActionWithStyle:UIContextualActionStyleDestructive
  284. title:NSLocalizedString(@"GroupCtr-yichu", @"")
  285. handler:^(UIContextualAction * _Nonnull action, __kindof UIView * _Nonnull sourceView, void (^ _Nonnull completionHandler)(BOOL)) {
  286. // 删除数据
  287. NSDictionary * dict = self.dataArray[indexPath.section];
  288. [self deleteFavoritesWithId:dict[@"id"]];
  289. [self.dataArray removeObjectAtIndex:indexPath.section];
  290. // 更新表格
  291. [tableView reloadData];
  292. // 告诉系统操作已完成
  293. completionHandler(YES);
  294. }];
  295. // 设置删除按钮颜色
  296. deleteAction.backgroundColor = [UIColor redColor];
  297. // 创建配置并返回
  298. UISwipeActionsConfiguration *config = [UISwipeActionsConfiguration configurationWithActions:@[deleteAction]];
  299. config.performsFirstActionWithFullSwipe = YES; // 完全滑动直接执行删除
  300. return config;
  301. }
  302. #pragma mark lazy
  303. - (UIButton *)rightBtn{
  304. if (!_rightBtn) {
  305. _rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  306. [_rightBtn setImage:[UIImage imageNamed:@"more_btn"] forState:UIControlStateNormal];
  307. }
  308. return _rightBtn;
  309. }
  310. - (UITextField *)searchTextfield{
  311. if (!_searchTextfield) {
  312. _searchTextfield = [[UITextField alloc] init];
  313. _searchTextfield.textColor = globalColor(GCTypeWhite);
  314. _searchTextfield.font = SYSFONT(14);
  315. _searchTextfield.borderStyle = UITextBorderStyleNone;
  316. _searchTextfield.backgroundColor = globalColor(GCTypeDark6);
  317. _searchTextfield.leftViewMode = UITextFieldViewModeAlways;
  318. UIView * leftView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 50, 36)];
  319. UIImageView * searchIcon = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"search_icon"]];
  320. [leftView addSubview:searchIcon];
  321. [searchIcon mas_makeConstraints:^(MASConstraintMaker *make) {
  322. make.size.mas_equalTo(CGSizeMake(15, 15));
  323. make.left.mas_equalTo(20);
  324. make.top.mas_equalTo(11);
  325. }];
  326. _searchTextfield.leftView = leftView;
  327. _searchTextfield.layer.cornerRadius = 5.f;
  328. _searchTextfield.layer.masksToBounds = YES;
  329. }
  330. return _searchTextfield;
  331. }
  332. - (UIButton *)allBtn{
  333. if (!_allBtn) {
  334. _allBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  335. [_allBtn setTitle:NSLocalizedString(@"Favorites_type_all", @"") forState:UIControlStateNormal];
  336. [_allBtn setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
  337. [_allBtn setTitleColor:globalColor(GCTypeGreen) forState:UIControlStateSelected];
  338. _allBtn.titleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
  339. _allBtn.selected = YES;
  340. [_allBtn addTarget:self action:@selector(categoryButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
  341. }
  342. return _allBtn;
  343. }
  344. - (UIButton *)textBtn{
  345. if (!_textBtn) {
  346. _textBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  347. [_textBtn setTitle:NSLocalizedString(@"Favorites_type_text", @"") forState:UIControlStateNormal];
  348. [_textBtn setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
  349. [_textBtn setTitleColor:globalColor(GCTypeGreen) forState:UIControlStateSelected];
  350. _textBtn.titleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
  351. [_textBtn addTarget:self action:@selector(categoryButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
  352. }
  353. return _textBtn;
  354. }
  355. - (UIButton *)pictrueBtn{
  356. if (!_pictrueBtn) {
  357. _pictrueBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  358. [_pictrueBtn setTitle:NSLocalizedString(@"Favorites_type_pictrue", @"") forState:UIControlStateNormal];
  359. [_pictrueBtn setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
  360. [_pictrueBtn setTitleColor:globalColor(GCTypeGreen) forState:UIControlStateSelected];
  361. _pictrueBtn.titleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
  362. [_pictrueBtn addTarget:self action:@selector(categoryButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
  363. }
  364. return _pictrueBtn;
  365. }
  366. - (UIButton *)fileBtn{
  367. if (!_fileBtn) {
  368. _fileBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  369. [_fileBtn setTitle:NSLocalizedString(@"Favorites_type_file", @"") forState:UIControlStateNormal];
  370. [_fileBtn setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
  371. [_fileBtn setTitleColor:globalColor(GCTypeGreen) forState:UIControlStateSelected];
  372. _fileBtn.titleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
  373. [_fileBtn addTarget:self action:@selector(categoryButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
  374. }
  375. return _fileBtn;
  376. }
  377. - (UIButton *)audioBtn{
  378. if (!_audioBtn) {
  379. _audioBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  380. [_audioBtn setTitle:NSLocalizedString(@"Favorites_type_audio", @"") forState:UIControlStateNormal];
  381. [_audioBtn setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
  382. [_audioBtn setTitleColor:globalColor(GCTypeGreen) forState:UIControlStateSelected];
  383. _audioBtn.titleLabel.font = [UIFont systemFontOfSize:14 weight:UIFontWeightRegular];
  384. [_audioBtn addTarget:self action:@selector(categoryButtonClicked:) forControlEvents:UIControlEventTouchUpInside];
  385. }
  386. return _audioBtn;
  387. }
  388. - (UIStackView *)buttonStackView{
  389. if (!_buttonStackView) {
  390. _buttonStackView = [[UIStackView alloc] initWithArrangedSubviews:@[self.allBtn,self.textBtn,self.pictrueBtn,self.fileBtn,self.audioBtn]];
  391. _buttonStackView.axis = UILayoutConstraintAxisHorizontal;
  392. _buttonStackView.alignment = UIStackViewAlignmentFill;
  393. _buttonStackView.distribution = UIStackViewDistributionFillEqually;
  394. }
  395. return _buttonStackView;
  396. }
  397. - (UIView *)bottomCube{
  398. if (!_bottomCube) {
  399. _bottomCube = [[UIView alloc] init];
  400. _bottomCube.backgroundColor = globalColor(GCTypeGreen);
  401. _bottomCube.layer.cornerRadius = 2.f;
  402. _bottomCube.layer.masksToBounds = YES;
  403. }
  404. return _bottomCube;
  405. }
  406. - (UITableView *)tableView{
  407. if (!_tableView) {
  408. _tableView = [[UITableView alloc] initWithFrame:CGRectZero style:UITableViewStyleInsetGrouped];
  409. _tableView.backgroundColor = UIColor.clearColor;
  410. _tableView.delegate = self;
  411. _tableView.dataSource = self;
  412. // 启用编辑模式
  413. _tableView.allowsSelectionDuringEditing = YES;
  414. [_tableView registerClass:FavoritesTextCell.class forCellReuseIdentifier:NSStringFromClass(FavoritesTextCell.class)];
  415. [_tableView registerClass:FavoritesPictrueCell.class forCellReuseIdentifier:NSStringFromClass(FavoritesPictrueCell.class)];
  416. [_tableView registerClass:FavoritesAudioCell.class forCellReuseIdentifier:NSStringFromClass(FavoritesAudioCell.class)];
  417. }
  418. return _tableView;
  419. }
  420. - (NSMutableArray *)dataArray{
  421. if (!_dataArray) {
  422. _dataArray = [NSMutableArray array];
  423. }
  424. return _dataArray;
  425. }
  426. #pragma mark statusBar
  427. - (UIStatusBarStyle)preferredStatusBarStyle{
  428. return UIStatusBarStyleLightContent;
  429. }
  430. @end