【练习LV2】home == four
// FourViewController.h
#import <UIKit/UIKit.h>
#import "SZViewController.h" //设置
#import "ZHYAQViewController.h" //账户与安全
#import "YEViewController.h" //银行卡
#import "YHKViewController.h" //余额
#import "YEBViewController.h" //余额宝
#import "ZCBViewController.h" //招财宝
#import "YLBViewController.h" //娱乐宝
#import "ZMXYFViewController.h" //芝麻信用分
#import "WDBZViewController.h" //我的保障
#import "AXJZViewController.h" //爱心捐赠
@interface FourViewController : UIViewController<UIGestureRecognizerDelegate,UITableViewDataSource,UITableViewDelegate>
//tableview声明几个数组,因为打算分三个区
@property(nonatomic,retain)NSArray*text_Array1;
@property(nonatomic,retain)NSArray*text_Array2;
@property(nonatomic,retain)NSArray*text_Array3;
@property(nonatomic,retain)NSArray*picture_Array1;
@property(nonatomic,retain)NSArray*picture_Array2;
@property(nonatomic,retain)NSArray*picture_Array3;
@end
// FourViewController.m
#import "FourViewController.h"
@interface FourViewController ()
{
//导航栏
UIView*nav_View;
UIButton*navright_Button;
UIButton*navleft_Button;
UILabel*title_Label;
//资料栏
UIView*zl_view1;
UIView*ye_view2;
UIView*yhk_view3;
}
@end
@implementation FourViewController
@synthesize text_Array1;
@synthesize text_Array2;
@synthesize text_Array3;
@synthesize picture_Array1;
@synthesize picture_Array2;
@synthesize picture_Array3;
/ 隐藏系统的navigationbar,tabbar,显示自定义的tabbar //
-(void)viewWillAppear:(BOOL)animated
{
self.navigationController.navigationBarHidden =YES;
self.tabBarController.tabBar.hidden = YES;
[[NSNotificationCenter defaultCenter] postNotificationName:@"bringCustomTabBarToFront" object:nil];
}
- (void)viewDidLoad{
[super viewDidLoad];
// 导航栏的自定义 /
nav_View=[[UIView alloc]initWithFrame:CGRectMake(0, 20, self.view.bounds.size.width, 44)];
nav_View.backgroundColor=[UIColor blackColor];
[self.view addSubview:nav_View];
/ 标题 //
title_Label=[[UILabel alloc]initWithFrame:CGRectMake(100, 27, 120, 30)];
title_Label.text=@"财富";
title_Label.textAlignment=NSTextAlignmentCenter;
title_Label.textColor=[UIColor whiteColor];
title_Label.font=[UIFont systemFontOfSize:20];
[self.view addSubview:title_Label];
/ 右边 //
navright_Button=[[UIButton alloc]initWithFrame:CGRectMake(self.view.bounds.size.width-65, 27, 50, 30)];
[navright_Button setTitle:@"设置" forState:UIControlStateNormal];
navright_Button.titleLabel.textAlignment=NSTextAlignmentRight;
navright_Button.titleLabel.font=[UIFont systemFontOfSize:16];
[navright_Button addTarget:self action:@selector(navright) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:navright_Button];
资料栏{本地数据,还未学习联网数据} / //
//创建A视图,个人资料
zl_view1=[[UIView alloc]initWithFrame:CGRectMake(0, nav_View.bounds.size.height+20, self.view.bounds.size.width, 70)];
zl_view1.backgroundColor=[UIColor yellowColor];
//A视图上加载图片
UIImageView*zl_imageView1=[[UIImageView alloc]initWithFrame:CGRectMake(10,10, 50, 50)];
[zl_imageView1 setImage:[UIImage imageNamed:@"1"]];
[zl_view1 addSubview:zl_imageView1];
//A视图上加载文字1
UILabel*zl_Label1=[[UILabel alloc]initWithFrame:CGRectMake(70, 20, 80, 20)];
zl_Label1.text=@"王二狗";
zl_Label1.font=[UIFont systemFontOfSize:16];
[zl_view1 addSubview:zl_Label1];
//A视图上加载文字2
UILabel*zl_Label2=[[UILabel alloc]initWithFrame:CGRectMake(70, 40, 80, 20)];
zl_Label2.font=[UIFont systemFontOfSize:14];
zl_Label2.text=@"187XXXXXXXXX";
[zl_view1 addSubview:zl_Label2];
//原视图上加载A视图
[self.view addSubview:zl_view1];
//创建A视图点击事件,声明方法-(void)toGeRen,.h文件注意代理@interface FourViewController : UIViewController<UIGestureRecognizerDelegate>
zl_view1.userInteractionEnabled=YES;
UITapGestureRecognizer*geren_Tap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(toGeRen:)];
[zl_view1 addGestureRecognizer:geren_Tap];
余额(方法同上) /
ye_view2=[[UIView alloc]initWithFrame:CGRectMake(0, zl_view1.bounds.size.height+nav_View.bounds.size.height+20, self.view.bounds.size.width/2, 30)]; //y的值还有待研究
ye_view2.backgroundColor=[UIColor redColor];
UILabel*ye_Label1=[[UILabel alloc]initWithFrame:CGRectMake(10, 10, self.view.bounds.size.width/4-10, 10)];
ye_Label1.text=@"余额";
ye_Label1.font=[UIFont systemFontOfSize:13];
[ye_view2 addSubview:ye_Label1];
UILabel*ye_Labe2=[[UILabel alloc]initWithFrame:CGRectMake(self.view.bounds.size.width/4, 10, self.view.bounds.size.width/4-10, 10)];
ye_Labe2.text=@"2222.22";
ye_Labe2.font=[UIFont systemFontOfSize:13];
[ye_view2 addSubview:ye_Labe2];
ye_Labe2.textAlignment=NSTextAlignmentRight;
[self.view addSubview:ye_view2];
ye_view2.userInteractionEnabled=YES;
UITapGestureRecognizer*ye_Tap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(toYE:)];
[ye_view2 addGestureRecognizer:ye_Tap];
银行卡(方法同上) /
yhk_view3=[[UIView alloc]initWithFrame:CGRectMake(self.view.bounds.size.width/2, zl_view1.bounds.size.height+nav_View.bounds.size.height+20, self.view.bounds.size.width/2, 30)]; //y的值还有待研究
yhk_view3.backgroundColor=[UIColor greenColor];
UILabel*yhk_Label1=[[UILabel alloc]initWithFrame:CGRectMake(10, 10, self.view.bounds.size.width/4-10, 10)];
yhk_Label1.text=@"银行卡";
yhk_Label1.font=[UIFont systemFontOfSize:13];
[yhk_view3 addSubview:yhk_Label1];
UILabel*yhk_Label2=[[UILabel alloc]initWithFrame:CGRectMake(self.view.bounds.size.width/4, 10, self.view.bounds.size.width/4-10, 10)];
yhk_Label2.text=@"4张";
yhk_Label2.font=[UIFont systemFontOfSize:13];
yhk_Label2.textAlignment=NSTextAlignmentRight;
[yhk_view3 addSubview:yhk_Label2];
[self.view addSubview:yhk_view3];
yhk_view3.userInteractionEnabled=YES;
UITapGestureRecognizer*yhk_Tap=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(toYHK:)];
[yhk_view3 addGestureRecognizer:yhk_Tap];
表格栏tabbarview /
NSArray*tArray1=[[NSArray alloc]initWithObjects:@"余额宝",@"找财报",@"娱乐宝", nil];
text_Array1=tArray1;
NSArray*tArray2=[[NSArray alloc]initWithObjects:@"芝麻信用分",@"我的保障", nil];
text_Array2=tArray2;
NSArray*tArray3=[[NSArray alloc]initWithObjects:@"爱心捐赠", nil];
text_Array3=tArray3;
NSArray*pArray1=[[NSArray alloc]initWithObjects:[UIImage imageNamed:@"1"], [UIImage imageNamed:@"2"],[UIImage imageNamed:@"3"],nil];
picture_Array1=pArray1;
NSArray*pArray2=[[NSArray alloc]initWithObjects:[UIImage imageNamed:@"4"],[UIImage imageNamed:@"5"],nil];
picture_Array2=pArray2;
NSArray*pArray3=[[NSArray alloc]initWithObjects:[UIImage imageNamed:@"6"],nil];
picture_Array3=pArray3;
UITableView*cf_tableview=[[UITableView alloc]initWithFrame:CGRectMake(0, zl_view1.bounds.size.height+nav_View.bounds.size.height+20+yhk_view3.bounds.size.height, self.view.bounds.size.width, 500) style:UITableViewStyleGrouped];
cf_tableview.delegate=self;
cf_tableview.dataSource=self;
[cf_tableview setScrollEnabled:NO]; //不能滚动
[self.view addSubview:cf_tableview];
}
//多少组
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 3;
}
//每组多少个
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
if (section==0) {
return 3;
}else if (section==1){
return 2;
}else
return 1;
}
//创建cell,加载内容
-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString*CellIdentifier=@"Cell";
UITableViewCell*cell=[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell==nil) {
cell=[[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
}
if (indexPath.section==0) {
cell.textLabel.text=[text_Array1 objectAtIndex:[indexPath row]];
cell.imageView.image=[picture_Array1 objectAtIndex:[indexPath row]];
}else if (indexPath.section==1){
cell.textLabel.text=[text_Array2 objectAtIndex:[indexPath row]];
cell.imageView.image=[picture_Array2 objectAtIndex:[indexPath row]];
}else{
cell.textLabel.text=[text_Array3 objectAtIndex:[indexPath row]];
cell.imageView.image=[picture_Array3 objectAtIndex:[indexPath row]];
}
return cell;
}
//导航栏右键,设置
-(void)navright
{
SZViewController*sz_view=[[SZViewController alloc]init];
self.hidesBottomBarWhenPushed=YES;
sz_view.hidesBottomBarWhenPushed = YES;
[self.tabBarController.tabBar setHidden:YES];
[self.navigationController pushViewController:sz_view animated:YES];
}
//点击个人资料 与隐藏tabbar 有关 (点击手势)
-(void)toGeRen:(UITapGestureRecognizer*)gesture
{
ZHYAQViewController*zhyaq_View=[[ZHYAQViewController alloc]init];
zhyaq_View.hidesBottomBarWhenPushed = YES;
[self.tabBarController.tabBar setHidden:YES];
[self.navigationController pushViewController:zhyaq_View animated:YES];
}
//点击余额
-(void)toYE:(UITapGestureRecognizer*)gesture
{
YEViewController*ye_View=[[YEViewController alloc]init];
ye_View.hidesBottomBarWhenPushed = YES;
[self.tabBarController.tabBar setHidden:YES];
[self.navigationController pushViewController:ye_View animated:YES];
}
//点击银行卡
-(void)toYHK:(UITapGestureRecognizer*)gesture
{
YHKViewController*yhk_View=[[YHKViewController alloc]init];
yhk_View.hidesBottomBarWhenPushed = YES;
[self.tabBarController.tabBar setHidden:YES];
[self.navigationController pushViewController:yhk_View animated:YES];
}
分区的间距,头,尾
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
return 15;
}
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
return 1;
}
// cell 点击 //
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (indexPath.section==0) {
if (indexPath.row==0) {
YEBViewController*yebView=[[YEBViewController alloc]init ];
yebView.hidesBottomBarWhenPushed = YES;
[self.tabBarController.tabBar setHidden:YES];
[self.navigationController pushViewController:yebView animated:YES];
}else if (indexPath.row==1){
ZCBViewController*zcbView=[[ZCBViewController alloc]init];
zcbView.hidesBottomBarWhenPushed = YES;
[self.tabBarController.tabBar setHidden:YES];
[self.navigationController pushViewController:zcbView animated:YES];
}else{
YLBViewController*ylbView=[[YLBViewController alloc]init];
ylbView.hidesBottomBarWhenPushed = YES;
[self.tabBarController.tabBar setHidden:YES];
[self.navigationController pushViewController:ylbView animated:YES];
}
}else if (indexPath.section==1){
if (indexPath.row==0) {
ZMXYFViewController*zmxyfView=[[ZMXYFViewController alloc]init];
zmxyfView.hidesBottomBarWhenPushed = YES;
[self.tabBarController.tabBar setHidden:YES];
[self.navigationController pushViewController:zmxyfView animated:YES];
}else{
WDBZViewController*wdbzView=[[WDBZViewController alloc]init];
wdbzView.hidesBottomBarWhenPushed = YES;
[self.tabBarController.tabBar setHidden:YES];
[self.navigationController pushViewController:wdbzView animated:YES];
}
}else{
AXJZViewController*axjzView=[[AXJZViewController alloc]init];
axjzView.hidesBottomBarWhenPushed = YES;
[self.tabBarController.tabBar setHidden:YES];
[self.navigationController pushViewController:axjzView animated:YES];
}
}
- (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
【练习LV2】home == four相关推荐
- IOS开发-TableView表视图LV2
在上一章节IOS开发-TableView表视图基础的学习后, 我觉得对于表视图的学习不应只局限于基础知识的学习,应用在实战中的话想要构建丰富的多元化视图界面我想还是必须深入地再学习下. 于是有了这个L ...
- LV2股票逐笔成交接口量化
文章目录 一.LV2逐笔成交明细数据内容格式 二.获取LV2逐笔成交数据接口(2022.8.4日亲测有效) 三.逐笔成交介绍 一.LV2逐笔成交明细数据内容格式 {"success" ...
- 2018年天梯赛LV2题目汇总小结
Ⅰ.L2-1 分而治之---邻接表 分而治之,各个击破是兵家常用的策略之一.在战争中,我们希望首先攻下敌方的部分城市,使其剩余的城市变成孤立无援,然后再分头各个击破.为此参谋部提供了若干打击方案.本题 ...
- 通达信lv2接口程序怎么创建BOLL通道数据?
通达信lv2接口程序主要是面向的阅读对象以及接口文档主要包括哪些业务的接口,可以让读者有一个直观的认识.如:通达信lv2接口系统面向外部接入方的数据协议接口,主要包括:用户注册接口.同步用户.授权认证 ...
- 股票逐笔成交接口lv2
逐笔成交接口 先来看看返回结果: {"success": true,"message": "操作成功!","code": ...
- 计算机二级用英语简写,等级LV1,LV2是哪些英文的缩写?
LV是level的缩写. level 英[ˈlevl] 美[ˈlɛvəl] n. 水平,水准; 水平线,水平面; 水平仪; [物] 电平; adj. 水平的; 同高度的; 平均的; ...
- LV2之-----js 值类型和引用类型(基石1)
一.学习目标 1.值类型和引用类型的基本概念 2.常见的值类型和引用类型都有哪些? 3.数据类型检测 4.值类型和引用类型在内存中的存储机制 5.创建对象的方式有哪些? 6.对象属性名的点表示法和方括 ...
- lv2:JavaScript(一)
JavaScript 组成 script 注释 赋值和输出 数据类型 运算符 一元运算符 比较运算符 (比较运算符返回的是布尔值) 逻辑运算符 语句分类 条件语句 循环语句 基本操作 js 实现随fi ...
- LV2之-----canvas 画布实现 自转时钟 大转盘
canvas 画布运用实例:1.系统时钟 <!DOCTYPE html> <html lang="en"><head><meta char ...
- 2022天梯赛lv2 大众情人
L2-044 大众情人 分数 25 作者 陈越 单位 浙江大学 人与人之间总有一点距离感.我们假定两个人之间的亲密程度跟他们之间的距离感成反比,并且距离感是单向的.例如小蓝对小红患了单相思,从小蓝的眼 ...
最新文章
- IAAS、SAAS、PAAS
- 如何解决pip更新问题
- jsp页面实现打印 .
- JAVA通过JCO连接SAP例子
- 电影《你好,李焕英》进入全球票房榜前100
- 直播不是造车,特斯拉开店玩直播却栽了个“跟头”
- JS --- this(4)
- 英文语音识别_英文语音识别软件_英文语音识别翻译 - 云+社区 - 腾讯云
- js渐渐入门之懒人框架- laz.js
- 【渝粤教育】国家开放大学2018年秋季 8660-22T (1)农科化学基础知识 参考试题
- 使用MonkeyTest对Android客户端进行压力测试 自动化代码
- java 连接sybase数据库_Jdbc连Sybase数据库的几种方法_MySQL
- 半导体物理学习记录——概述
- 计算机网络(读书笔记)
- 这次要讲不清前后端分离,我都怎么地!
- 计划bom表 java_ERP总结系列(BOM浅谈)
- 【PB】动态报表格式自由定义的实现
- 读《浪潮之巅(上)》有感
- psu 计算机 排名,PSU计算机工程专业研究生排名必然得当心去考察
- 域名系统(DNS)说明
热门文章
- OnRobot:协作机器人领域的先锋 Enrico Krog Iversen 与丹麦成长基金 (Danish Growth Fund) 强强联手,踌躇满志地打造全新机器人臂端工具合资企业
- 『2023北京智源大会』大模型新基建与智力运营论坛
- 高版本CubeIDE下使用DAP-LINK教程
- 怎样安装linux中文字体,Linux 下安装中文字体
- php 时间到期,仅当当前时间到期时间(php mysqli)时列出作业
- 一年后 php_php 一年后,一月后,一日后,一年前,一月后,一周后
- 采晨露煮茶,伴朝阳晚霞,于红尘潇洒
- 开启漫漫的agera之旅
- Ubuntu 16.04下安装以太坊编译环境以及设置合约功能(支持geth 1.6以及solc 0.4.16版本以上)
- 慢SQL,MySQL 查询优化 IS NULL、IS NOT NULL、LIKE ‘%*%’、UNION ALL、OR,影响SQL效率的条件