myviewcontroll

This commit is contained in:
2014-08-14 00:51:26 +08:00
parent dfba1212e7
commit 664ed1063a
13 changed files with 323 additions and 10 deletions
+22
View File
@@ -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 = "<group>"; };
A9AF6CA21994D0660076C0EE /* ad3@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ad3@2x.png"; sourceTree = "<group>"; };
A9AF6CA31994D0660076C0EE /* ad4@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "ad4@2x.png"; sourceTree = "<group>"; };
A9C69441199BB7B100B2CECE /* icon_person_take_image@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon_person_take_image@2x.png"; sourceTree = "<group>"; };
A9C69444199BBEB200B2CECE /* MyTotalProfitCellView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MyTotalProfitCellView.h; sourceTree = "<group>"; };
A9C69445199BBEB200B2CECE /* MyTotalProfitCellView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MyTotalProfitCellView.m; sourceTree = "<group>"; };
A9C69447199BC1F500B2CECE /* gray_select_arrow.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = gray_select_arrow.png; sourceTree = "<group>"; };
A9EAA033199857F5001A872A /* HomeMainView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HomeMainView.h; sourceTree = "<group>"; };
A9EAA034199857F5001A872A /* HomeMainView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HomeMainView.m; sourceTree = "<group>"; };
A9EAA03F19985EDE001A872A /* HomeMainView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HomeMainView.xib; sourceTree = "<group>"; };
@@ -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 = "<group>";
};
A9C69443199BBE9500B2CECE /* MyView */ = {
isa = PBXGroup;
children = (
A9C69444199BBEB200B2CECE /* MyTotalProfitCellView.h */,
A9C69445199BBEB200B2CECE /* MyTotalProfitCellView.m */,
);
path = MyView;
sourceTree = "<group>";
};
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 */,
+5
View File
@@ -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
@@ -0,0 +1,22 @@
//
// MyTotalProfitCellView.h
// ManagerDemo
//
// Created by xmfish on 14-8-13.
// Copyright (c) 2014年 ash. All rights reserved.
//
#import <UIKit/UIKit.h>
@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
@@ -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
@@ -8,6 +8,7 @@
#import <UIKit/UIKit.h>
@interface MoreViewController : UIViewController
@interface MoreViewController : UIViewController<UITableViewDataSource, UITableViewDelegate>
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@end
@@ -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
@@ -6,6 +6,7 @@
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MoreViewController">
<connections>
<outlet property="tableView" destination="AZ2-p3-oop" id="ykM-PK-cZq"/>
<outlet property="view" destination="1" id="3"/>
</connections>
</placeholder>
@@ -14,10 +15,11 @@
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="AZ2-p3-oop">
<tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" style="grouped" separatorStyle="default" rowHeight="44" sectionHeaderHeight="10" sectionFooterHeight="10" translatesAutoresizingMaskIntoConstraints="NO" id="AZ2-p3-oop">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<inset key="separatorInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
</tableView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
@@ -8,7 +8,7 @@
#import <UIKit/UIKit.h>
@interface MyViewController : UIViewController
@interface MyViewController : UIViewController<UITableViewDataSource,UITableViewDelegate>
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@end
+152 -1
View File
@@ -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];
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="6154.21" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="4514" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6153.13"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3746"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="MyViewController">
@@ -15,9 +15,10 @@
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="22" sectionFooterHeight="22" translatesAutoresizingMaskIntoConstraints="NO" id="EYG-x6-MXU">
<tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" style="grouped" allowsSelection="NO" rowHeight="44" sectionHeaderHeight="1" sectionFooterHeight="1" translatesAutoresizingMaskIntoConstraints="NO" id="EYG-x6-MXU">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<color key="backgroundColor" cocoaTouchSystemColor="groupTableViewBackgroundColor"/>
<inset key="separatorInset" minX="0.0" minY="0.0" maxX="0.0" maxY="0.0"/>
</tableView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
@@ -25,4 +26,4 @@
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina4"/>
</view>
</objects>
</document>
</document>
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB