// // ActiveMesagelistVC.m // GIGA // // Created by lianxiang on 2018/8/23. // Copyright © 2018年 com.giga.ios. All rights reserved. // #import "ActiveMesagelistVC.h" #import "MessageListViewCell.h" #import "MessageDetailViewController.h" @interface ActiveMesagelistVC () @property (nonatomic,strong) NSMutableArray *dataArr; @end @implementation ActiveMesagelistVC - (void)viewDidLoad { [super viewDidLoad]; self.title = @"活动消息"; _dataArr = [[NSMutableArray alloc] init]; [self.view addSubview:self.tableView]; self.tableView.delegate = self; self.tableView.dataSource = self; self.tableView.separatorStyle = UITableViewCellSelectionStyleNone; self.tableView.tableFooterView = [[UIView alloc] init]; self.tableView.backgroundColor = GIGARGB(242, 242, 242, 1); } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { return 1; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ return 3; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return 302; } - (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{ return 20; } -(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{ return 1; } - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section{ UIView *headerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 20)]; headerView.backgroundColor = GIGARGB(242, 242, 242, 1); UILabel *timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, headerView.frame.size.width, 20)]; timeLabel.textAlignment = NSTextAlignmentCenter; timeLabel.textColor = [UIColor lightGrayColor]; timeLabel.font = [UIFont systemFontOfSize:14]; timeLabel.text = @"2018年8月22日"; [headerView addSubview:timeLabel]; return headerView; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ MessageListViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MessageListViewCell"]; if (!cell) { cell = [[[NSBundle mainBundle] loadNibNamed:@"MessageListViewCell" owner:self options:nil] lastObject]; } //[cell loadCellDataAtIndex:indexPath]; return cell; } -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{ [tableView deselectRowAtIndexPath:indexPath animated:YES]; MessageDetailViewController *detailVC = [[MessageDetailViewController alloc] init]; [self.navigationController pushViewController:detailVC animated:YES]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } @end