OC实现个人中心页面
AppDelegate.m:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
//创建窗口
self.window = [[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
//设置窗口的根控制器
mainViewController *mainVC = [[mainViewController alloc]init];
self.window.rootViewController = mainVC;
//显示窗口
[self.window makeKeyAndVisible];
return YES;
}
mainViewController.m:
@interface mainViewController ()<UITableViewDataSource,UITableViewDelegate>
{
UITableView *personalTableView;
NSArray *dataSource;
} @end @implementation mainViewController - (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view.
personalTableView = [[UITableView alloc]initWithFrame:CGRectMake(, , [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height) style:UITableViewStyleGrouped];
[self.view addSubview:personalTableView];
personalTableView.dataSource = self;
personalTableView.delegate = self;
personalTableView.bounces = NO;//yes,就是滚动超过边界会反弹有反弹回来的效果; NO,那么滚动到达边界会立刻停止。
personalTableView.showsVerticalScrollIndicator = NO;//不显示右侧滑块
personalTableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;//分割线
dataSource = @[@"我的分享",@"密码管理",@"用户协议",@"关于"];
} #pragma mark - TbaleView的数据源代理方法实现
//返回组数的代理方法
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return ;
}
//返回行数的代理方法
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
if (section==){
return ;
}else if (section==){
return dataSource.count;
}else{
return ;
}
}
//每个分组上边预留的空白高度
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section{
return ;
}
//每个分组下边预留的空白高度
-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section{
if (section==){
return ;
}
return ;
}
//每个分组下对应的tableView高度
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
if(indexPath.section == ){
return ;
}
return ;
}
//返回每一行Cell的代理方法
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
// 1 初始化Cell
// 1.1 设置Cell的重用标识
static NSString *ID = @"cell";
// 1.2 去缓存池中取Cell
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
// 1.3 若取不到便创建一个带重用标识的Cell
if (cell == nil){
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:ID];
} if (indexPath.section==) {
cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"userinfo"]; UIImageView *imageView = [[UIImageView alloc]initWithFrame:CGRectMake(, , , )];
imageView.image = [UIImage imageNamed:@""];
[cell.contentView addSubview:imageView]; UILabel *nameLabel = [[UILabel alloc]initWithFrame:CGRectMake(, , , )];
nameLabel.text = @"小燕子";
[cell.contentView addSubview:nameLabel]; }else if (indexPath.section==){
cell.textLabel.text = [dataSource objectAtIndex:indexPath.row];
//设置Cell右边的小箭头
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; }else{
cell.textLabel.text = @"退出登录";
cell.textLabel.textAlignment = NSTextAlignmentCenter;
} //设置Cell右边的小箭头
//cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
return cell;
} - (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
效果图:

OC实现个人中心页面的更多相关文章
- OC 观察者模式(通知中心,KVO)
OC 观察者模式(通知中心,KVO) 什么是观察者模式??? A对B的变化感兴趣,就注册为B的观察者,当B发生变化时通知A,告知B发生了变化.这就是观察者模式. 观察者模式定义了一种一对多的依赖关系, ...
- mxonline实战14,全局搜索,修改个人中心页面个人资料信息
对应github地址:第14天 一. 全局搜索 1. 使用关键词搜索 courses/views.py/CourseListView新增代码,不用把search_keywords传到前端
- (7)Flask微电影之会员中心页面搭建
一.添加会员中心页面的路由 修改app/home/views.py内容,追加会员有关的5个路由: # coding:utf8 from . import home from flask import ...
- iOS运营级B2B服务平台App、自定义图标库、个人中心页面、识别身份证Demo、瀑布流等源码
iOS精选源码 简单的个人中心页面-自定义导航栏并予以渐变动画 一个近乎完整的可识别中国身份证信息的Demo 可自动快速... iOS可自定义图表库 - PNChart 开源一款曾是运营级的B2B服务 ...
- python3下scrapy爬虫(第六卷:利用cookie模拟登陆抓取个人中心页面)
之前我们爬取的都是那些无需登录就要可以使用的网站但是当我们想爬取自己或他人的个人中心时就需要做登录,一般进入登录页面有两种 ,一个是独立页面登陆,另一个是弹窗,我们先不管验证码登陆的问题 ,现在试一下 ...
- 32Flutter仿京东商城项目 用户中心页面布局
import 'package:flutter/material.dart'; import 'package:flutter_jdshop/services/ScreenAdapter.dart'; ...
- 谈谈iOS开发如何写个人中心这类页面--静态tableView页面的编写
本文来自 网易云社区 . 一.本文讲的是什么问题? 在开发 iOS 应用时,基本都会遇到个人中心.设置.详情信息等页面,这里截取了某应用的详情编辑页面和个人中心页面,如下: 我们以页面结构的角度考虑这 ...
- 【京东个人中心】——Nodejs/Ajax/HTML5/Mysql爬坑之静态页面
一.引言 接着上一篇,京东个人中心的所有功能数据分析完成之后,现在需要把静态页面完成,实现过程中要用到的技术有:Bootstrap.html5表单新特性等.除此之外,还要利用Node.js的Expre ...
- 《微信小程序七日谈》- 第四天:页面路径最多五层?导航可以这么玩
<微信小程序七日谈>系列文章: 第一天:人生若只如初见: 第二天:你可能要抛弃原来的响应式开发思维: 第三天:玩转Page组件的生命周期: 第四天:页面路径最多五层?导航可以这么玩 微信小 ...
随机推荐
- AngularJS学习之 登录表单 清爽验证(边学边更新)
注册过程的确好多需要验证的,但是注册成功之后的登录就简单多了, 只要用户 输入 用户名和密码, ajax向后台提交登录请求, 根据返回的结果确定用户名或者密码是否正确即可登录. 所以这个登录表单的验证 ...
- Javascript、Jquery获取浏览器和屏幕各种高度宽度[mark]
Javascript: IE中:document.body.clientWidth ==> BODY对象宽度document.body.clientHeight ==> BODY对象高度d ...
- Android JNI的使用方法
1.JNI是什么 JNI是Java Native Interface的缩写,它提供若干的API实现Java与其他语言之间的通信.而Android Framework由基于Java语言的的Java层与基 ...
- Android工程中javax annotation Nullable找不到的替代方案
我们在某些Android开源库中会遇到下面的引用找不到的问题:import javax.annotation.Nonnull;import javax.annotation.Nullable; 其实A ...
- mac 安装 mysql.tar.gz
解压目录到 MySQL 默认安装路径 /usr/local/mysql 下, /usr/local路径不存在时, 先 sudo mkdir /usr/local 创建. # 移动解压后的二进制包到安装 ...
- Expo大作战(二十三)--expo中expo kit 高级属性(没干货)
简要:本系列文章讲会对expo进行全面的介绍,本人从2017年6月份接触expo以来,对expo的研究断断续续,一路走来将近10个月,废话不多说,接下来你看到内容,讲全部来与官网 我猜去全部机翻+个人 ...
- Python+Selenium笔记(六):元素定位
(一) 前言 Web应用以及包含超文本标记语言(HTML).层叠样式表(CSS).JS脚本的WEB页面,基于用户的操作(例如点击提交按钮),浏览器向WEB服务器发送请求,WEB服务器响应请求,返 ...
- 关于Apache连接数限制的设置
昨天晚上收到监视团队的电话,说web服务器连不上.(作为DBA,这貌似超出了我的工作范畴啊...) 于是马上VPN连上服务器,发现网络负载均衡下的两台Apache服务器都没有响应,而服务器OS层面上正 ...
- mysql 表格操作指令大全(Show、desc、create、insert into、delete、select、drop、update、alter)
使用数据库 use 数据库名 eg: use weiying 2. 查看库里所有的表 Show tables 3.查看所表的结构 desc 表名 desc score 4.建表create tabl ...
- python urllib库
python2和python3中的urllib urllib提供了一个高级的 Web 通信库,支持基本的 Web 协议,如 HTTP.FTP 和 Gopher 协议,同时也支持对本地文件的访问. 具体 ...