RQPlaceDetailNoteViewController.m 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. //
  2. // RQPlaceDetailNoteViewController.m
  3. // JiaPei
  4. //
  5. // Created by 张嵘 on 2023/4/17.
  6. //
  7. #import "RQPlaceDetailNoteViewController.h"
  8. @interface RQPlaceDetailNoteViewController ()
  9. /// viewModel
  10. @property (nonatomic, readonly, strong) RQPlaceDetailNoteViewModel *viewModel;
  11. @end
  12. @implementation RQPlaceDetailNoteViewController
  13. @dynamic viewModel;
  14. - (void)viewDidLoad {
  15. [super viewDidLoad];
  16. @weakify(self)
  17. self.tableView.backgroundColor = UIColor.whiteColor;
  18. [[[RQNotificationCenter rac_addObserverForName:RQUserNotificationOrWechatSuccess object:nil] takeUntil:self.rac_willDeallocSignal] subscribeNext:^(NSNotification * note) {
  19. @strongify(self)
  20. // PayResp *resp = (PayResp *)note.object;
  21. [RQ_COMMON_MANAGER updateVipList];
  22. [self.tableView reloadData];
  23. }];
  24. }
  25. #pragma mark - OverrideMethods
  26. /// 配置tableView的区域
  27. - (UIEdgeInsets)contentInset {
  28. return UIEdgeInsetsMake(10, 0, RQ_APPLICATION_SAFEAREA_BOTTOM_HEIGHT + 54.f + (RQ_APPLICATION_NAV_BAR_HEIGHT + QMUIHelper.statusBarHeightConstant), 0);
  29. }
  30. - (UITableViewCell *)tableView:(UITableView *)tableView dequeueReusableCellWithIdentifier:(NSString *)identifier forIndexPath:(NSIndexPath *)indexPath {
  31. RQCommonGroupViewModel *groupViewModel = self.viewModel.dataSource[indexPath.section];
  32. RQCommonItemViewModel *itemViewModel = groupViewModel.itemViewModels[indexPath.row];
  33. return [NSClassFromString(itemViewModel.itemClassName) cellWithTableView:tableView];
  34. }
  35. - (void)configureCell:(RQCommonCell *)cell atIndexPath:(NSIndexPath *)indexPath withObject:(id)object {
  36. [cell bindViewModel:object];
  37. }
  38. #pragma mark - UITableViewDelegate & UITableViewDataSource
  39. - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
  40. !self.scrollCallback ?: self.scrollCallback(scrollView);
  41. }
  42. #pragma mark - JXPagerViewListViewDelegate
  43. - (UIView *)listView {
  44. return self.view;
  45. }
  46. - (UIScrollView *)listScrollView {
  47. return self.tableView;
  48. }
  49. - (void)listViewDidScrollCallback:(void (^)(UIScrollView *))callback {
  50. self.scrollCallback = callback;
  51. }
  52. @end