// // TabMessageViewController.m // LekangGuard // // Created by ecell on 2023/6/7. // #import "TabMessageViewController.h" #import "TabMessageTableViewCell.h" #import "MessageViewController.h" #import "SchAndJobMessageViewController.h" @interface TabMessageViewController () @property (nonatomic ,strong) CommonTableView *msgTable; @property (nonatomic ,strong) NSArray *titleArr; @property (nonatomic ,strong) NSArray *imageArr; @end @implementation TabMessageViewController - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.zx_navTitle = @"消息"; self.view.backgroundColor = KKBackgroundGrey; self.titleArr = @[@"校园通知",@"班级作业",@"设备消息"]; self.imageArr = @[@"msg_sch_icon",@"msg_job_icon",@"msg_device_icon"]; [self.view addSubview:self.msgTable]; [self.msgTable mas_makeConstraints:^(MASConstraintMaker *make) { make.left.right.equalTo(self.view); make.top.equalTo(self.view).offset(iPhoneX_NavHeight); make.bottom.equalTo(self.view); }]; } - (CommonTableView *)msgTable { if (!_msgTable) { _msgTable = [[CommonTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain cellHeight:80 cellRow:self.titleArr.count isAdaptive:NO isLine:NO commonCell:TabMessageTableViewCell.class createCell:^(ZZTableViewCell * _Nonnull cells, NSIndexPath * _Nonnull indexPath) { TabMessageTableViewCell *cell = (TabMessageTableViewCell *)cells; cell.titleStr = self.titleArr[indexPath.row]; cell.imageStr = self.imageArr[indexPath.row]; } selectedCell:^(UITableView * _Nonnull tableView, NSIndexPath * _Nonnull indexPath) { if (indexPath.row < 2) { SchAndJobMessageViewController *vc = [[SchAndJobMessageViewController alloc] init]; vc.navTitle = self.titleArr[indexPath.row]; vc.viewType = indexPath.row; [self.navigationController pushViewController:vc animated:YES]; } else if (indexPath.row == 2) { MessageViewController *vc = [MessageViewController new]; vc.selectedIndex = 0; [self.navigationController pushViewController:vc animated:YES]; } } DidscrollView:^(UIScrollView * _Nonnull scrollView) { }]; _msgTable.backgroundColor = KKClearColor; } return _msgTable; } /* #pragma mark - Navigation // In a storyboard-based application, you will often want to do a little preparation before navigation - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender { // Get the new view controller using [segue destinationViewController]. // Pass the selected object to the new view controller. } */ @end