diff --git a/ManagerDemo.xcodeproj/project.pbxproj b/ManagerDemo.xcodeproj/project.pbxproj index e2e7bdf..8c05974 100644 --- a/ManagerDemo.xcodeproj/project.pbxproj +++ b/ManagerDemo.xcodeproj/project.pbxproj @@ -190,6 +190,8 @@ A9EC95BE19B54FEC00681678 /* textField_bg@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9EC95BD19B54FEC00681678 /* textField_bg@2x.png */; }; A9EC95C019B5501B00681678 /* icon_phone@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9EC95BF19B5501B00681678 /* icon_phone@2x.png */; }; A9EC95C319B55CF100681678 /* ManagerUser.m in Sources */ = {isa = PBXBuildFile; fileRef = A9EC95C219B55CF100681678 /* ManagerUser.m */; }; + A9EE5EE719C20CDA004E7A2C /* WYDAmountTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A9EE5EE519C20CDA004E7A2C /* WYDAmountTableViewCell.m */; }; + A9EE5EE819C20CDA004E7A2C /* WYDAmountTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9EE5EE619C20CDA004E7A2C /* WYDAmountTableViewCell.xib */; }; A9F1E18619ACB63100B6A441 /* DTCoreTextTableViewCell.m in Sources */ = {isa = PBXBuildFile; fileRef = A9F1E18519ACB63100B6A441 /* DTCoreTextTableViewCell.m */; }; A9F1E18819ACB64D00B6A441 /* DTCoreTextTableViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9F1E18719ACB64D00B6A441 /* DTCoreTextTableViewCell.xib */; }; /* End PBXBuildFile section */ @@ -456,6 +458,9 @@ A9EC95BF19B5501B00681678 /* icon_phone@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_phone@2x.png"; sourceTree = ""; }; A9EC95C119B55CF100681678 /* ManagerUser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ManagerUser.h; sourceTree = ""; }; A9EC95C219B55CF100681678 /* ManagerUser.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ManagerUser.m; sourceTree = ""; }; + A9EE5EE419C20CDA004E7A2C /* WYDAmountTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WYDAmountTableViewCell.h; sourceTree = ""; }; + A9EE5EE519C20CDA004E7A2C /* WYDAmountTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WYDAmountTableViewCell.m; sourceTree = ""; }; + A9EE5EE619C20CDA004E7A2C /* WYDAmountTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = WYDAmountTableViewCell.xib; sourceTree = ""; }; A9F1E18419ACB63100B6A441 /* DTCoreTextTableViewCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DTCoreTextTableViewCell.h; sourceTree = ""; }; A9F1E18519ACB63100B6A441 /* DTCoreTextTableViewCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DTCoreTextTableViewCell.m; sourceTree = ""; }; A9F1E18719ACB64D00B6A441 /* DTCoreTextTableViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = DTCoreTextTableViewCell.xib; sourceTree = ""; }; @@ -919,6 +924,9 @@ A93320CE19C02F240090D640 /* FundAmountViewController.h */, A93320CF19C02F240090D640 /* FundAmountViewController.m */, A93320D019C02F240090D640 /* FundAmountViewController.xib */, + A9EE5EE419C20CDA004E7A2C /* WYDAmountTableViewCell.h */, + A9EE5EE519C20CDA004E7A2C /* WYDAmountTableViewCell.m */, + A9EE5EE619C20CDA004E7A2C /* WYDAmountTableViewCell.xib */, ); path = MyView; sourceTree = ""; @@ -1144,6 +1152,7 @@ A9C69452199BD14D00B2CECE /* more_icon_3@2x.png in Resources */, A9C69455199BD14D00B2CECE /* more_icon_7@2x.png in Resources */, A9EAA04F1998787B001A872A /* hk_home_center_bg@2x.png in Resources */, + A9EE5EE819C20CDA004E7A2C /* WYDAmountTableViewCell.xib in Resources */, A9AF6C6319949CD30076C0EE /* icon_dock_rt@2x.png in Resources */, A9354F5D19B870C700FDCB52 /* BaseListViewController.xib in Resources */, A93320C319BFE8090090D640 /* MyTotalAmountViewController.xib in Resources */, @@ -1268,6 +1277,7 @@ A94FE51E199C9C3C00626DE5 /* MoveSocialCellView.m in Sources */, A93F8806199A077F00875287 /* OtherListViewController.m in Sources */, A9AF6C2E199483520076C0EE /* MainViewController.m in Sources */, + A9EE5EE719C20CDA004E7A2C /* WYDAmountTableViewCell.m in Sources */, A9AF6C42199498C40076C0EE /* MyViewController.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; diff --git a/ManagerDemo.xcworkspace/xcuserdata/xmfish.xcuserdatad/UserInterfaceState.xcuserstate b/ManagerDemo.xcworkspace/xcuserdata/xmfish.xcuserdatad/UserInterfaceState.xcuserstate index 21fc06e..f6e5857 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/SlideSwitch/QCSlideSwitchView.m b/ManagerDemo/Common/SlideSwitch/QCSlideSwitchView.m index 8b260c9..3db6f97 100644 --- a/ManagerDemo/Common/SlideSwitch/QCSlideSwitchView.m +++ b/ManagerDemo/Common/SlideSwitch/QCSlideSwitchView.m @@ -9,10 +9,10 @@ #import "QCSlideSwitchView.h" -static const CGFloat kHeightOfTopScrollView = 30.0f; -static const CGFloat kWidthOfButtonMargin = 44.0f; -static const CGFloat kFontSizeOfTabButton = 17.0f; -static const NSUInteger kTagOfRightSideButton = 999; +CGFloat kHeightOfTopScrollView = 30.0f; +CGFloat kWidthOfButtonMargin = 44.0f; +CGFloat kFontSizeOfTabButton = 17.0f; +NSUInteger kTagOfRightSideButton = 999; @implementation QCSlideSwitchView @@ -164,6 +164,11 @@ static const NSUInteger kTagOfRightSideButton = 999; [_shadowImageView setImage:_shadowImage]; [_topScrollView addSubview:_shadowImageView]; + if ([_viewArray count] == 2) { + kWidthOfButtonMargin = 70.0f; + }else if([_viewArray count] == 3){ + kWidthOfButtonMargin = 44.0f; + } //顶部tabbar的总长度 CGFloat topScrollViewContentWidth = kWidthOfButtonMargin; //每个tab偏移量 @@ -272,13 +277,13 @@ static const NSUInteger kTagOfRightSideButton = 999; //如果 当前显示的最后一个tab文字超出右边界 if (sender.frame.origin.x - _topScrollView.contentOffset.x > self.bounds.size.width - (kWidthOfButtonMargin+sender.bounds.size.width)) { //向左滚动视图,显示完整tab文字 - [_topScrollView setContentOffset:CGPointMake(sender.frame.origin.x - (_topScrollView.bounds.size.width- (kWidthOfButtonMargin+sender.bounds.size.width)), 0) animated:YES]; +// [_topScrollView setContentOffset:CGPointMake(sender.frame.origin.x - (_topScrollView.bounds.size.width- (kWidthOfButtonMargin+sender.bounds.size.width)), 0) animated:YES]; } //如果 (tab的文字坐标 - 当前滚动视图左边界所在整个视图的x坐标) < 按钮的隔间 ,代表tab文字已超出边界 if (sender.frame.origin.x - _topScrollView.contentOffset.x < kWidthOfButtonMargin) { //向右滚动视图(tab文字的x坐标 - 按钮间隔 = 新的滚动视图左边界在整个视图的x坐标),使文字显示完整 - [_topScrollView setContentOffset:CGPointMake(sender.frame.origin.x - kWidthOfButtonMargin, 0) animated:YES]; +// [_topScrollView setContentOffset:CGPointMake(sender.frame.origin.x - kWidthOfButtonMargin, 0) animated:YES]; } } diff --git a/ManagerDemo/MainView/ListView/ListViewController.m b/ManagerDemo/MainView/ListView/ListViewController.m index aed7604..8e8adfd 100644 --- a/ManagerDemo/MainView/ListView/ListViewController.m +++ b/ManagerDemo/MainView/ListView/ListViewController.m @@ -68,7 +68,8 @@ } -(void)firstRefresh { - if (_productInfoArray.count <= 0) { + NSLog(@"%d",_productInfoArray.count); + if ([_productInfoArray count] <= 0) { [self headerBeginRefreshing]; } } diff --git a/ManagerDemo/MainView/ListView/OtherListViewController.m b/ManagerDemo/MainView/ListView/OtherListViewController.m index 036e224..46701c8 100644 --- a/ManagerDemo/MainView/ListView/OtherListViewController.m +++ b/ManagerDemo/MainView/ListView/OtherListViewController.m @@ -30,7 +30,6 @@ { [super viewDidLoad]; // Do any additional setup after loading the view. - _productInfoArray = [[NSMutableArray alloc] init]; } #pragma mark MJRefreshDelegate diff --git a/ManagerDemo/MainView/MyView/MyHoldAmountViewController.m b/ManagerDemo/MainView/MyView/MyHoldAmountViewController.m index 3e702fc..fb77b18 100644 --- a/ManagerDemo/MainView/MyView/MyHoldAmountViewController.m +++ b/ManagerDemo/MainView/MyView/MyHoldAmountViewController.m @@ -7,10 +7,12 @@ // #import "MyHoldAmountViewController.h" - +#import "WYDAmountViewController.h" +#import "FundAmountViewController.h" @interface MyHoldAmountViewController () { NSArray* _typeArray; + NSMutableArray* _listViewContrllerArray; //界面列表 } @end @@ -22,6 +24,7 @@ if (self) { // Custom initialization _typeArray = nil; + _listViewContrllerArray = [[NSMutableArray alloc] init]; } return self; } @@ -30,7 +33,7 @@ { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. - + [ManagerUtil SetSubViewExternNone:self]; self.slideSwitchView.tabItemNormalColor = [QCSlideSwitchView colorFromHexRGB:@"868686"]; self.slideSwitchView.tabItemSelectedColor = [QCSlideSwitchView colorFromHexRGB:@"bb0b15"]; self.slideSwitchView.shadowImage = [[UIImage imageNamed:@"red_line_and_shadow.png"]stretchableImageWithLeftCapWidth:59.0f topCapHeight:0.0f]; @@ -44,6 +47,7 @@ [daiDaiTongApi getHoldAssetTypewithCompletionBlock:^(id jsonRes) { if ([[jsonRes objectForKey:@"succ"] integerValue] == 1) { _typeArray = [NSArray arrayWithArray:[jsonRes objectForKey:@"types"]]; + [self initSlideSwitchView]; }else{ [MBProgressHUD errorHudWithView:nil label:[jsonRes objectForKey:@"err_msg"] hidesAfter:0.5]; } @@ -51,26 +55,39 @@ [MBProgressHUD errorHudWithView:self.view label:@"网络出错" hidesAfter:0.5]; }]; } +-(void)initSlideSwitchView +{ + [_listViewContrllerArray removeAllObjects]; + for (NSString* type in _typeArray) { + if ([type isEqualToString:@"RYT"]) { + WYDAmountViewController* wydAmountViewController = [[WYDAmountViewController alloc] init]; + wydAmountViewController.title = @"稳盈贷"; + [_listViewContrllerArray addObject:wydAmountViewController]; + }else{ + FundAmountViewController* fundAmountViewController = [[FundAmountViewController alloc] init]; + fundAmountViewController.title = @"货币基金"; + [_listViewContrllerArray addObject:fundAmountViewController]; + } + } + [self.slideSwitchView buildUI]; +} #pragma mark - 滑动tab视图代理方法 -//- (NSUInteger)numberOfTab:(QCSlideSwitchView *)view -//{ -// // you can set the best you can do it ; -// return listViewContrllerArray.count; -//} -// -//- (UIViewController *)slideSwitchView:(QCSlideSwitchView *)view viewOfTab:(NSUInteger)number -//{ -// -// return [listViewContrllerArray objectAtIndex:number]; -//} -// -// -//- (void)slideSwitchView:(QCSlideSwitchView *)view didselectTab:(NSUInteger)number -//{ -// _nowSelectTab = number; -// //进行第一次刷新 -// [(ListViewController*)[listViewContrllerArray objectAtIndex:number] firstRefresh]; -//} +- (NSUInteger)numberOfTab:(QCSlideSwitchView *)view +{ + // you can set the best you can do it ; + return _listViewContrllerArray.count; +} + +- (UIViewController *)slideSwitchView:(QCSlideSwitchView *)view viewOfTab:(NSUInteger)number +{ + + return [_listViewContrllerArray objectAtIndex:number]; +} + + +- (void)slideSwitchView:(QCSlideSwitchView *)view didselectTab:(NSUInteger)number +{ +} - (void)didReceiveMemoryWarning { diff --git a/ManagerDemo/MainView/MyView/MyHoldAmountViewController.xib b/ManagerDemo/MainView/MyView/MyHoldAmountViewController.xib index 53aeae1..204e5fd 100644 --- a/ManagerDemo/MainView/MyView/MyHoldAmountViewController.xib +++ b/ManagerDemo/MainView/MyView/MyHoldAmountViewController.xib @@ -19,6 +19,9 @@ + + + diff --git a/ManagerDemo/MainView/MyView/MyTotalAmountViewController.h b/ManagerDemo/MainView/MyView/MyTotalAmountViewController.h index 98608eb..a1cf0ef 100644 --- a/ManagerDemo/MainView/MyView/MyTotalAmountViewController.h +++ b/ManagerDemo/MainView/MyView/MyTotalAmountViewController.h @@ -14,6 +14,8 @@ float _holdAmount; //持有资产 float _accBalance; //余额 } +- (IBAction)accBalanceClick:(id)sender; +- (IBAction)holdAmountClick:(id)sender; @property (assign, nonatomic)float totalAmount; @property (assign, nonatomic)float holdAmount; @property (assign, nonatomic)float accBalance; diff --git a/ManagerDemo/MainView/MyView/MyTotalAmountViewController.m b/ManagerDemo/MainView/MyView/MyTotalAmountViewController.m index 6849df1..31a765b 100644 --- a/ManagerDemo/MainView/MyView/MyTotalAmountViewController.m +++ b/ManagerDemo/MainView/MyView/MyTotalAmountViewController.m @@ -7,9 +7,11 @@ // #import "MyTotalAmountViewController.h" - +#import "MyHoldAmountViewController.h" @interface MyTotalAmountViewController () - +{ + UILabel* _titleLabel; +} @end @implementation MyTotalAmountViewController @@ -30,6 +32,12 @@ { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. + + _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 160, 49)]; + _titleLabel.textAlignment = NSTextAlignmentCenter; + _titleLabel.backgroundColor = [UIColor clearColor]; + _titleLabel.numberOfLines = 0; + self.navigationItem.titleView = _titleLabel; _holdAmountView.progressColor = [UIColor redColor]; _holdAmountView.wrapperColor = Touch_BackGroudColor; _holdAmountView.wrapperArcWidth = 5.0; @@ -45,6 +53,7 @@ _totalAmount = totalAmount; _holdAmount = holdAmount; _accBalance = accBalance; + _titleLabel.text = [NSString stringWithFormat:@"持有资产(元)\n%.2f",totalAmount]; _holdAmountLabel.attributedString = [self getPercentStr:holdAmount/totalAmount withColor:@"red"]; _accBalanceLabel.attributedString = [self getPercentStr:accBalance/totalAmount withColor:@"red"]; [_holdAmountView setProgress:holdAmount/totalAmount animated:YES]; @@ -68,4 +77,12 @@ // Dispose of any resources that can be recreated. } +- (IBAction)accBalanceClick:(id)sender { +} + +- (IBAction)holdAmountClick:(id)sender { + MyHoldAmountViewController* myHoldAmountViewController = [[MyHoldAmountViewController alloc] init]; + myHoldAmountViewController.hidesBottomBarWhenPushed = YES; + [self.navigationController pushViewController:myHoldAmountViewController animated:YES]; +} @end diff --git a/ManagerDemo/MainView/MyView/MyTotalAmountViewController.xib b/ManagerDemo/MainView/MyView/MyTotalAmountViewController.xib index fb2e328..989b16e 100644 --- a/ManagerDemo/MainView/MyView/MyTotalAmountViewController.xib +++ b/ManagerDemo/MainView/MyView/MyTotalAmountViewController.xib @@ -56,6 +56,26 @@ + + diff --git a/ManagerDemo/MainView/MyView/WYDAmountTableViewCell.h b/ManagerDemo/MainView/MyView/WYDAmountTableViewCell.h new file mode 100644 index 0000000..9db8e12 --- /dev/null +++ b/ManagerDemo/MainView/MyView/WYDAmountTableViewCell.h @@ -0,0 +1,13 @@ +// +// WYDAmountTableViewCell.h +// ManagerDemo +// +// Created by xmfish on 14-9-12. +// Copyright (c) 2014年 ash. All rights reserved. +// + +#import + +@interface WYDAmountTableViewCell : UITableViewCell + +@end diff --git a/ManagerDemo/MainView/MyView/WYDAmountTableViewCell.m b/ManagerDemo/MainView/MyView/WYDAmountTableViewCell.m new file mode 100644 index 0000000..9031883 --- /dev/null +++ b/ManagerDemo/MainView/MyView/WYDAmountTableViewCell.m @@ -0,0 +1,25 @@ +// +// WYDAmountTableViewCell.m +// ManagerDemo +// +// Created by xmfish on 14-9-12. +// Copyright (c) 2014年 ash. All rights reserved. +// + +#import "WYDAmountTableViewCell.h" + +@implementation WYDAmountTableViewCell + +- (void)awakeFromNib +{ + // Initialization code +} + +- (void)setSelected:(BOOL)selected animated:(BOOL)animated +{ + [super setSelected:selected animated:animated]; + + // Configure the view for the selected state +} + +@end diff --git a/ManagerDemo/MainView/MyView/WYDAmountTableViewCell.xib b/ManagerDemo/MainView/MyView/WYDAmountTableViewCell.xib new file mode 100644 index 0000000..fb9cd90 --- /dev/null +++ b/ManagerDemo/MainView/MyView/WYDAmountTableViewCell.xib @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/ManagerDemo/MainView/MyView/WYDAmountViewController.h b/ManagerDemo/MainView/MyView/WYDAmountViewController.h index d24a26f..ae2070c 100644 --- a/ManagerDemo/MainView/MyView/WYDAmountViewController.h +++ b/ManagerDemo/MainView/MyView/WYDAmountViewController.h @@ -7,8 +7,9 @@ // #import - -@interface WYDAmountViewController : UIViewController -@property (weak, nonatomic) IBOutlet UITableView *tableView; +#import "BaseListViewController.h" +@interface WYDAmountViewController : BaseListViewController +@property (strong, nonatomic) IBOutlet UIView *topView; +@property (weak, nonatomic) IBOutlet UILabel *totalLabel; @end diff --git a/ManagerDemo/MainView/MyView/WYDAmountViewController.m b/ManagerDemo/MainView/MyView/WYDAmountViewController.m index f4c99ca..3e1b424 100644 --- a/ManagerDemo/MainView/MyView/WYDAmountViewController.m +++ b/ManagerDemo/MainView/MyView/WYDAmountViewController.m @@ -9,7 +9,9 @@ #import "WYDAmountViewController.h" @interface WYDAmountViewController () - +{ + NSDictionary* _infoDic; +} @end @implementation WYDAmountViewController @@ -27,20 +29,65 @@ { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. - _tableView.delegate = self; - _tableView.dataSource = self; + self.tableView.tableHeaderView = _topView; + _infoDic = nil; } +-(void)loadDataWithDic:(NSDictionary *)dic withType:(NSString *)typeStr WithcompletionBlock:(CompletionBlock)completionBlock failedBlock:(FailedBlock)failedBlock +{ + [super loadDataWithDic:nil withType:@"investRepayingQuery.do" WithcompletionBlock:^(id jsonRes){ + [_infoArray addObjectsFromArray:[jsonRes objectForKey:@"datas"]]; + _infoDic = [NSDictionary dictionaryWithDictionary:jsonRes]; + _totalLabel.text = [_infoDic objectForKey:@"rytFund"]; + [self.tableView reloadData]; + }failedBlock:^(NSError *error){ + + }]; +} #pragma mark UITableViewDelegate -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { - return 1; + if (_infoDic) { + return _infoArray.count+1; + } + return 0; } -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { + if (section == 0) { + return 3; + } return 1; } - +-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath +{ + static NSString* cellIdentifier = @"cellIdentifier"; + UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; + if (!cell) { + cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cellIdentifier]; + } + if (indexPath.section == 0) { + switch (indexPath.row) { + case 0: + cell.textLabel.text = @"待收本金(元)"; + cell.detailTextLabel.text = [_infoDic objectForKey:@"waitReturnMoney"]; + break; + case 1: + cell.textLabel.text = @"未结算收益(元)"; + cell.detailTextLabel.text = @"0.02"; + break; + case 2: + cell.textLabel.text = @"已还款"; + cell.detailTextLabel.text = @"查看记录"; + cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; + break; + default: + break; + } + } + + return cell; +} - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; diff --git a/ManagerDemo/MainView/MyView/WYDAmountViewController.xib b/ManagerDemo/MainView/MyView/WYDAmountViewController.xib index 6cb75bd..a02e846 100644 --- a/ManagerDemo/MainView/MyView/WYDAmountViewController.xib +++ b/ManagerDemo/MainView/MyView/WYDAmountViewController.xib @@ -7,6 +7,8 @@ + + @@ -15,10 +17,11 @@ - + - + + @@ -36,6 +39,20 @@ + +