add message exercises

This commit is contained in:
lianxiang
2018-08-23 18:09:15 +08:00
parent 3b8f57d02f
commit d43d7eaaf6
51 changed files with 1713 additions and 122 deletions
@@ -0,0 +1,13 @@
//
// ActiveMesagelistVC.h
// GIGA
//
// Created by lianxiang on 2018/8/23.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "GiGaBaseViewController.h"
@interface ActiveMesagelistVC : GiGaBaseViewController
@end
@@ -0,0 +1,99 @@
//
// 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
@@ -0,0 +1,13 @@
//
// GiGaMasssagesVC.h
// GIGA
//
// Created by lianxiang on 2018/8/23.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "GiGaBaseViewController.h"
@interface GiGaMasssagesVC : GiGaBaseViewController
@end
@@ -0,0 +1,106 @@
//
// GiGaMasssagesVC.m
// GIGA
//
// Created by lianxiang on 2018/8/23.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "GiGaMasssagesVC.h"
#import "MAssaageCenterCell.h"
#import "ActiveMesagelistVC.h"
#import "GiGaServiceViewController.h"
#import "GiGaSystemViewController.h"
@interface GiGaMasssagesVC ()
@property (nonatomic,strong)NSMutableArray *dataArr;
@end
@implementation GiGaMasssagesVC
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
self.title = @"消息中心";
self.view.backgroundColor = GIGARGB(242, 242, 242, 1);
_dataArr = [NSMutableArray new];
[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);
self.tableView.tableHeaderView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 5)];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 1;
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 3;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 80;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
return 0.1;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
return 10;
}
-(UIView *)tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section{
return [[UIView alloc] init];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
MAssaageCenterCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MAssaageCenterCell"];
if (!cell) {
cell = [[[NSBundle mainBundle] loadNibNamed:@"MAssaageCenterCell" owner:self options:nil] lastObject];
}
[cell loadCellDataAtIndex:indexPath];
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
[tableView deselectRowAtIndexPath:indexPath animated:YES];
if (indexPath.section == 0) {
ActiveMesagelistVC *activeVC = [[ActiveMesagelistVC alloc] init];
[self.navigationController pushViewController:activeVC animated:YES];
}else if (indexPath.section == 1){
GiGaServiceViewController *serviceVC = [[GiGaServiceViewController alloc] init];
[self.navigationController pushViewController:serviceVC animated:YES];
}else{
GiGaSystemViewController *systemVC = [[GiGaSystemViewController alloc] init];
[self.navigationController pushViewController:systemVC animated:YES];
}
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
@@ -0,0 +1,13 @@
//
// GiGaServiceViewController.h
// GIGA
//
// Created by lianxiang on 2018/8/23.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "GiGaBaseViewController.h"
@interface GiGaServiceViewController : GiGaBaseViewController
@end
@@ -0,0 +1,39 @@
//
// GiGaServiceViewController.m
// GIGA
//
// Created by lianxiang on 2018/8/23.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "GiGaServiceViewController.h"
@interface GiGaServiceViewController ()
@end
@implementation GiGaServiceViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"服务消息";
self.view.backgroundColor = GIGARGB(242, 242, 242, 1);
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#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
@@ -0,0 +1,13 @@
//
// GiGaSystemViewController.h
// GIGA
//
// Created by lianxiang on 2018/8/23.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "GiGaBaseViewController.h"
@interface GiGaSystemViewController : GiGaBaseViewController
@end
@@ -0,0 +1,40 @@
//
// GiGaSystemViewController.m
// GIGA
//
// Created by lianxiang on 2018/8/23.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "GiGaSystemViewController.h"
@interface GiGaSystemViewController ()
@end
@implementation GiGaSystemViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"系统消息";
self.view.backgroundColor = GIGARGB(242, 242, 242, 1);
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#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
@@ -0,0 +1,13 @@
//
// MessageDetailViewController.h
// GIGA
//
// Created by lianxiang on 2018/8/23.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "GiGaBaseViewController.h"
@interface MessageDetailViewController : GiGaBaseViewController
@end
@@ -0,0 +1,39 @@
//
// MessageDetailViewController.m
// GIGA
//
// Created by lianxiang on 2018/8/23.
// Copyright © 2018年 com.giga.ios. All rights reserved.
//
#import "MessageDetailViewController.h"
@interface MessageDetailViewController ()
@end
@implementation MessageDetailViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.title = @"消息详情";
self.view.backgroundColor = GIGARGB(242, 242, 242, 1);
// Do any additional setup after loading the view.
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
/*
#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