diff --git a/ManagerDemo.xcodeproj/project.pbxproj b/ManagerDemo.xcodeproj/project.pbxproj index 4688cd8..00c6d49 100644 --- a/ManagerDemo.xcodeproj/project.pbxproj +++ b/ManagerDemo.xcodeproj/project.pbxproj @@ -83,6 +83,9 @@ A9AF6CA41994D0660076C0EE /* ad2@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9AF6CA11994D0660076C0EE /* ad2@2x.png */; }; A9AF6CA51994D0660076C0EE /* ad3@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9AF6CA21994D0660076C0EE /* ad3@2x.png */; }; A9AF6CA61994D0660076C0EE /* ad4@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9AF6CA31994D0660076C0EE /* ad4@2x.png */; }; + A9C69442199BB7B100B2CECE /* icon_person_take_image@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9C69441199BB7B100B2CECE /* icon_person_take_image@2x.png */; }; + A9C69446199BBEB200B2CECE /* MyTotalProfitCellView.m in Sources */ = {isa = PBXBuildFile; fileRef = A9C69445199BBEB200B2CECE /* MyTotalProfitCellView.m */; }; + A9C69448199BC1F500B2CECE /* gray_select_arrow.png in Resources */ = {isa = PBXBuildFile; fileRef = A9C69447199BC1F500B2CECE /* gray_select_arrow.png */; }; A9EAA035199857F5001A872A /* HomeMainView.m in Sources */ = {isa = PBXBuildFile; fileRef = A9EAA034199857F5001A872A /* HomeMainView.m */; }; A9EAA04019985EDE001A872A /* HomeMainView.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9EAA03F19985EDE001A872A /* HomeMainView.xib */; }; A9EAA04519986DC3001A872A /* fund_cell_label_bg_blue@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9EAA04119986DC3001A872A /* fund_cell_label_bg_blue@2x.png */; }; @@ -217,6 +220,10 @@ A9AF6CA11994D0660076C0EE /* ad2@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ad2@2x.png"; sourceTree = ""; }; A9AF6CA21994D0660076C0EE /* ad3@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ad3@2x.png"; sourceTree = ""; }; A9AF6CA31994D0660076C0EE /* ad4@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ad4@2x.png"; sourceTree = ""; }; + A9C69441199BB7B100B2CECE /* icon_person_take_image@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_person_take_image@2x.png"; sourceTree = ""; }; + A9C69444199BBEB200B2CECE /* MyTotalProfitCellView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyTotalProfitCellView.h; sourceTree = ""; }; + A9C69445199BBEB200B2CECE /* MyTotalProfitCellView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyTotalProfitCellView.m; sourceTree = ""; }; + A9C69447199BC1F500B2CECE /* gray_select_arrow.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = gray_select_arrow.png; sourceTree = ""; }; A9EAA033199857F5001A872A /* HomeMainView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HomeMainView.h; sourceTree = ""; }; A9EAA034199857F5001A872A /* HomeMainView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HomeMainView.m; sourceTree = ""; }; A9EAA03F19985EDE001A872A /* HomeMainView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HomeMainView.xib; sourceTree = ""; }; @@ -452,6 +459,8 @@ A9AF6C4D19949CAD0076C0EE /* Resource */ = { isa = PBXGroup; children = ( + A9C69447199BC1F500B2CECE /* gray_select_arrow.png */, + A9C69441199BB7B100B2CECE /* icon_person_take_image@2x.png */, A93F87811999BB1D00875287 /* red_line_and_shadow@2x.png */, A9EAA051199879CC001A872A /* pie_chart_center.png */, A9EAA04B1998787B001A872A /* hk_home_center__cycle@2x.png */, @@ -519,12 +528,22 @@ A9AF6C971994C97F0076C0EE /* MainView */ = { isa = PBXGroup; children = ( + A9C69443199BBE9500B2CECE /* MyView */, A9A660B31999180000E9D166 /* ListView */, A9AA325B19970304000BE4FB /* HomeView */, ); path = MainView; sourceTree = ""; }; + A9C69443199BBE9500B2CECE /* MyView */ = { + isa = PBXGroup; + children = ( + A9C69444199BBEB200B2CECE /* MyTotalProfitCellView.h */, + A9C69445199BBEB200B2CECE /* MyTotalProfitCellView.m */, + ); + path = MyView; + sourceTree = ""; + }; A9EAA05319988C55001A872A /* MRCircularProgressView */ = { isa = PBXGroup; children = ( @@ -616,6 +635,7 @@ A9EAA04719986DC3001A872A /* fund_cell_label_bg_green@2x.png in Resources */, A93F8802199A077F00875287 /* ListViewController.xib in Resources */, A93F8804199A077F00875287 /* LoanListCell.xib in Resources */, + A9C69448199BC1F500B2CECE /* gray_select_arrow.png in Resources */, A9AF6C731994B5890076C0EE /* icon_bar_share@2x.png in Resources */, A9EAA04019985EDE001A872A /* HomeMainView.xib in Resources */, A988A902199A755300EB10AA /* FundListCell.xib in Resources */, @@ -647,6 +667,7 @@ A9AF6C8F1994C5700076C0EE /* MJRefresh.bundle in Resources */, A9AF6C6419949CD30076C0EE /* icon_dock_service_actived@2x.png in Resources */, A9AF6C791994B5890076C0EE /* tabbarShadowImage@2x.png in Resources */, + A9C69442199BB7B100B2CECE /* icon_person_take_image@2x.png in Resources */, A9AF6BF719947DD00076C0EE /* InfoPlist.strings in Resources */, A9AF6C761994B5890076C0EE /* icon_indicate_more_down@2x.png in Resources */, A9EAA04619986DC3001A872A /* fund_cell_label_bg_gray@2x.png in Resources */, @@ -736,6 +757,7 @@ A9AF6C931994C5700076C0EE /* MJRefreshHeaderView.m in Sources */, A9AF6BF919947DD00076C0EE /* main.m in Sources */, A93F877C1999ACF600875287 /* MBProgressHUD+Util.m in Sources */, + A9C69446199BBEB200B2CECE /* MyTotalProfitCellView.m in Sources */, A9AF6C33199484200076C0EE /* HomeViewController.m in Sources */, A93F8800199A077F00875287 /* FundListViewController.m in Sources */, A93F87801999B92800875287 /* QCSlideSwitchView.m in Sources */, diff --git a/ManagerDemo.xcworkspace/xcuserdata/xmfish.xcuserdatad/UserInterfaceState.xcuserstate b/ManagerDemo.xcworkspace/xcuserdata/xmfish.xcuserdatad/UserInterfaceState.xcuserstate index 1073487..60dd9e5 100644 Binary files a/ManagerDemo.xcworkspace/xcuserdata/xmfish.xcuserdatad/UserInterfaceState.xcuserstate and b/ManagerDemo.xcworkspace/xcuserdata/xmfish.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/ManagerDemo/Common/ManagerConstants.h b/ManagerDemo/Common/ManagerConstants.h index 3a66782..685d1e4 100644 --- a/ManagerDemo/Common/ManagerConstants.h +++ b/ManagerDemo/Common/ManagerConstants.h @@ -20,4 +20,9 @@ */ #define ScreenWidth [[UIScreen mainScreen] bounds].size.width #define ScreenHeight [[UIScreen mainScreen] bounds].size.height + +/** + * 系统字体 + */ +#define Font_Black(fontsize) [UIFont fontWithName:@"HelveticaNeue-Bold" size:fontsize]; #endif diff --git a/ManagerDemo/MainView/MyView/MyTotalProfitCellView.h b/ManagerDemo/MainView/MyView/MyTotalProfitCellView.h new file mode 100644 index 0000000..18b33b5 --- /dev/null +++ b/ManagerDemo/MainView/MyView/MyTotalProfitCellView.h @@ -0,0 +1,22 @@ +// +// MyTotalProfitCellView.h +// ManagerDemo +// +// Created by xmfish on 14-8-13. +// Copyright (c) 2014年 ash. All rights reserved. +// + +#import + +@interface MyTotalProfitCellView : UIView +{ + UILabel* _totalTitleLabel; + UILabel* _totalMoneyLabel; + UILabel* _profitTitleLabel; + UILabel* _profitMoneyLabel; +} +@property(strong, nonatomic) UILabel* totalTitleLabel; +@property(strong, nonatomic) UILabel* totalMoneyLabel; +@property(strong, nonatomic) UILabel* profitTitleLabel; +@property(strong, nonatomic) UILabel* profitMoneyLabel; +@end diff --git a/ManagerDemo/MainView/MyView/MyTotalProfitCellView.m b/ManagerDemo/MainView/MyView/MyTotalProfitCellView.m new file mode 100644 index 0000000..1a8abae --- /dev/null +++ b/ManagerDemo/MainView/MyView/MyTotalProfitCellView.m @@ -0,0 +1,76 @@ +// +// MyTotalProfitCellView.m +// ManagerDemo +// +// Created by xmfish on 14-8-13. +// Copyright (c) 2014年 ash. All rights reserved. +// + +#import "MyTotalProfitCellView.h" + +@implementation MyTotalProfitCellView + +- (id)initWithFrame:(CGRect)frame +{ + self = [super initWithFrame:frame]; + if (self) { + // Initialization code + self.backgroundColor = [UIColor clearColor]; + } + return self; +} + + +// Only override drawRect: if you perform custom drawing. +// An empty implementation adversely affects performance during animation. +- (void)drawRect:(CGRect)rect +{ + // Drawing code + + CGSize size = self.frame.size; + + //总收益标签 + _totalTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 10, size.width/2, 30)]; + _totalTitleLabel.textAlignment = NSTextAlignmentCenter; + _totalTitleLabel.textColor = [UIColor grayColor]; + _totalTitleLabel.text = @"总资产(元)"; + [self addSubview:_totalTitleLabel]; + //总共的钱 + _totalMoneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 40, size.width/2, 30)]; + _totalMoneyLabel.textAlignment = NSTextAlignmentCenter; + _totalMoneyLabel.textColor = [UIColor darkGrayColor]; + [_totalMoneyLabel setFont:[UIFont systemFontOfSize:25.0]]; + _totalMoneyLabel.text = @"0.0"; + [self addSubview:_totalMoneyLabel]; + + //中间的线 + UIView* lineView = [[UIView alloc] initWithFrame:CGRectMake(size.width/2, 10, 1, size.height-10*2)]; + lineView.backgroundColor = [UIColor colorWithWhite:0.8 alpha:1.0]; + [self addSubview:lineView]; + //左边三角形 + UIImageView* leftImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"gray_select_arrow"]]; + leftImageView.frame = CGRectMake(size.width/2-20, size.height-22, 12, 12); + [self addSubview:leftImageView]; + //右边三角形 + UIImageView* rightImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"gray_select_arrow"]]; + rightImageView.frame = CGRectMake(size.width-20, size.height-22, 12, 12); + [self addSubview:rightImageView]; + + //累计收益标签 + _profitTitleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0+size.width/2, 10, size.width/2, 30)]; + _profitTitleLabel.textAlignment = NSTextAlignmentCenter; + _profitTitleLabel.textColor = [UIColor grayColor]; + _profitTitleLabel.text = @"累计收益(元)"; + [self addSubview:_profitTitleLabel]; + + //总共的收益 + _profitMoneyLabel = [[UILabel alloc] initWithFrame:CGRectMake(size.width/2, 40, size.width/2, 30)]; + _profitMoneyLabel.textAlignment = NSTextAlignmentCenter; + _profitMoneyLabel.textColor = [UIColor darkGrayColor]; + [_profitMoneyLabel setFont:[UIFont systemFontOfSize:25.0]]; + _profitMoneyLabel.text = @"0.0"; + [self addSubview:_profitMoneyLabel]; +} + + +@end diff --git a/ManagerDemo/MainViewControll/MoreViewController.h b/ManagerDemo/MainViewControll/MoreViewController.h index 391b6e6..4f8f1eb 100644 --- a/ManagerDemo/MainViewControll/MoreViewController.h +++ b/ManagerDemo/MainViewControll/MoreViewController.h @@ -8,6 +8,7 @@ #import -@interface MoreViewController : UIViewController +@interface MoreViewController : UIViewController +@property (weak, nonatomic) IBOutlet UITableView *tableView; @end diff --git a/ManagerDemo/MainViewControll/MoreViewController.m b/ManagerDemo/MainViewControll/MoreViewController.m index 1283e53..3fb1457 100644 --- a/ManagerDemo/MainViewControll/MoreViewController.m +++ b/ManagerDemo/MainViewControll/MoreViewController.m @@ -29,6 +29,39 @@ // Do any additional setup after loading the view from its nib. [self.navigationItem setTitle:@"第三页"]; [ManagerUtil SetSubViewExternNone:self]; + _tableView.delegate = self; + _tableView.dataSource = self; +// [_tableView style] = UITableViewStyleGrouped; + +} +#pragma mark UITableViewDelegate +-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 4; +} +-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return 3; +} +-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section +{ + return 1.0; +} +-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +{ + return 10.0; +} +-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath +{ + return 44.0; +} +-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + + UITableViewCell* cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:nil]; + + + return cell; } - (void)didReceiveMemoryWarning diff --git a/ManagerDemo/MainViewControll/MoreViewController.xib b/ManagerDemo/MainViewControll/MoreViewController.xib index 6c9defb..2fddcd1 100644 --- a/ManagerDemo/MainViewControll/MoreViewController.xib +++ b/ManagerDemo/MainViewControll/MoreViewController.xib @@ -6,6 +6,7 @@ + @@ -14,10 +15,11 @@ - + - + + diff --git a/ManagerDemo/MainViewControll/MyViewController.h b/ManagerDemo/MainViewControll/MyViewController.h index 2e14324..513dfd5 100644 --- a/ManagerDemo/MainViewControll/MyViewController.h +++ b/ManagerDemo/MainViewControll/MyViewController.h @@ -8,7 +8,7 @@ #import -@interface MyViewController : UIViewController +@interface MyViewController : UIViewController @property (weak, nonatomic) IBOutlet UITableView *tableView; @end diff --git a/ManagerDemo/MainViewControll/MyViewController.m b/ManagerDemo/MainViewControll/MyViewController.m index 18d56a7..4baedce 100644 --- a/ManagerDemo/MainViewControll/MyViewController.m +++ b/ManagerDemo/MainViewControll/MyViewController.m @@ -7,7 +7,8 @@ // #import "MyViewController.h" - +#import "MyTotalProfitCellView.h" +#import "MJRefresh.h" @interface MyViewController () @end @@ -29,8 +30,158 @@ // Do any additional setup after loading the view from its nib. [self.navigationItem setTitle:@"第三页"]; [ManagerUtil SetSubViewExternNone:self]; + + //左边按钮 + [self.navigationItem setLeftBarButtonItem:[[UIBarButtonItem alloc] initWithTitle:@"左边按钮" style:UIBarButtonItemStyleDone target:self action:@selector(leftBarBtnClick:)]]; + + //右边按钮。 + [self.navigationItem setRightBarButtonItem:[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(rightBarBtnClick:)]]; + + + _tableView.delegate = self; + _tableView.dataSource = self; + [_tableView addHeaderWithTarget:self action:@selector(headerRereshing)]; + + _tableView.delegate = self; + _tableView.dataSource = self; + +} +#pragma mark MJRefreshDelegate +- (void)headerRereshing +{ + + // 2.2秒后刷新表格UI + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + // 刷新表格 + [self.tableView reloadData]; + + // (最好在刷新表格后调用)调用endRefreshing可以结束刷新状态 + [self.tableView headerEndRefreshing]; + }); } +- (void)footerRereshing +{ + + // 2.2秒后刷新表格UI + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + // 刷新表格 + [self.tableView reloadData]; + + // (最好在刷新表格后调用)调用endRefreshing可以结束刷新状态 + [self.tableView footerEndRefreshing]; + }); +} + +#pragma mark UITableViewDelegate +-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView +{ + return 5; +} +-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section +{ + return 1; +} +-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section +{ + return 1.0; +} +-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section +{ + return 10.0; +} +-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath +{ + switch (indexPath.section) { + case 0: + case 3: + case 4: + return 44.0; + break; + case 1: + return 140; + break; + case 2: + return 80; + break; + default: + break; + } + return 44.0; +} +-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + + UITableViewCell* cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:nil]; + switch (indexPath.section) { + case 0: + { + cell.textLabel.text = @"吴盛华"; + cell.imageView.image = [UIImage imageNamed:@"icon_person_take_image"]; + cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; + cell.detailTextLabel.text = @"13212312313"; + } + break; + case 1: + { + cell.backgroundColor = [UIColor redColor]; + UILabel* timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 25, 320, 30)]; + timeLabel.textColor = [UIColor whiteColor]; + timeLabel.font = Font_Black(15); + timeLabel.textAlignment = NSTextAlignmentCenter; + timeLabel.text = @"08月12日收益(元)"; + [cell addSubview:timeLabel]; + UILabel* profitLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 30, 320, 100)]; + profitLabel.textColor = [UIColor whiteColor]; + profitLabel.font = Font_Black(50); + profitLabel.textAlignment = NSTextAlignmentCenter; + profitLabel.text = @"100.04"; + [cell addSubview:profitLabel]; + } + break; + case 2: + { + CGRect frmae = cell.frame; + frmae.size.height = [self tableView:tableView heightForRowAtIndexPath:indexPath]; + cell.backgroundColor = [UIColor colorWithWhite:0.9 alpha:1.0]; + MyTotalProfitCellView* myTotalProfitCellView = [[MyTotalProfitCellView alloc] initWithFrame:frmae]; + [cell addSubview:myTotalProfitCellView]; + } + break; + case 3: + { + cell.textLabel.text = @"我是超人"; + cell.textLabel.textColor = [UIColor grayColor]; + + cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; + } + break; + case 4: + { + cell.textLabel.text = @"我是超人"; + cell.textLabel.textColor = [UIColor grayColor]; + cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; + cell.detailTextLabel.text = @"100分"; + } + break; + default: + break; + } + + + return cell; +} + +#pragma mark - UIBarButtonClick 导航条两边按钮 +-(void)leftBarBtnClick:(id)sender +{ + DLog(@"首页左边按钮"); +} +-(void)rightBarBtnClick:(id)sender +{ + DLog(@"首页右边按钮"); + [_tableView headerBeginRefreshing]; +} - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; diff --git a/ManagerDemo/MainViewControll/MyViewController.xib b/ManagerDemo/MainViewControll/MyViewController.xib index 34cacfb..e2018dd 100644 --- a/ManagerDemo/MainViewControll/MyViewController.xib +++ b/ManagerDemo/MainViewControll/MyViewController.xib @@ -1,7 +1,7 @@ - + - + @@ -15,9 +15,10 @@ - + - + + @@ -25,4 +26,4 @@ - + \ No newline at end of file diff --git a/ManagerDemo/Resource/gray_select_arrow.png b/ManagerDemo/Resource/gray_select_arrow.png new file mode 100644 index 0000000..6e1c785 Binary files /dev/null and b/ManagerDemo/Resource/gray_select_arrow.png differ diff --git a/ManagerDemo/Resource/icon_person_take_image@2x.png b/ManagerDemo/Resource/icon_person_take_image@2x.png new file mode 100644 index 0000000..9da2e77 Binary files /dev/null and b/ManagerDemo/Resource/icon_person_take_image@2x.png differ