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实现个人中心页面的更多相关文章

  1. OC 观察者模式(通知中心,KVO)

    OC 观察者模式(通知中心,KVO) 什么是观察者模式??? A对B的变化感兴趣,就注册为B的观察者,当B发生变化时通知A,告知B发生了变化.这就是观察者模式. 观察者模式定义了一种一对多的依赖关系, ...

  2. mxonline实战14,全局搜索,修改个人中心页面个人资料信息

    对应github地址:第14天   一. 全局搜索   1. 使用关键词搜索 courses/views.py/CourseListView新增代码,不用把search_keywords传到前端

  3. (7)Flask微电影之会员中心页面搭建

    一.添加会员中心页面的路由 修改app/home/views.py内容,追加会员有关的5个路由: # coding:utf8 from . import home from flask import ...

  4. iOS运营级B2B服务平台App、自定义图标库、个人中心页面、识别身份证Demo、瀑布流等源码

    iOS精选源码 简单的个人中心页面-自定义导航栏并予以渐变动画 一个近乎完整的可识别中国身份证信息的Demo 可自动快速... iOS可自定义图表库 - PNChart 开源一款曾是运营级的B2B服务 ...

  5. python3下scrapy爬虫(第六卷:利用cookie模拟登陆抓取个人中心页面)

    之前我们爬取的都是那些无需登录就要可以使用的网站但是当我们想爬取自己或他人的个人中心时就需要做登录,一般进入登录页面有两种 ,一个是独立页面登陆,另一个是弹窗,我们先不管验证码登陆的问题 ,现在试一下 ...

  6. 32Flutter仿京东商城项目 用户中心页面布局

    import 'package:flutter/material.dart'; import 'package:flutter_jdshop/services/ScreenAdapter.dart'; ...

  7. 谈谈iOS开发如何写个人中心这类页面--静态tableView页面的编写

    本文来自 网易云社区 . 一.本文讲的是什么问题? 在开发 iOS 应用时,基本都会遇到个人中心.设置.详情信息等页面,这里截取了某应用的详情编辑页面和个人中心页面,如下: 我们以页面结构的角度考虑这 ...

  8. 【京东个人中心】——Nodejs/Ajax/HTML5/Mysql爬坑之静态页面

    一.引言 接着上一篇,京东个人中心的所有功能数据分析完成之后,现在需要把静态页面完成,实现过程中要用到的技术有:Bootstrap.html5表单新特性等.除此之外,还要利用Node.js的Expre ...

  9. 《微信小程序七日谈》- 第四天:页面路径最多五层?导航可以这么玩

    <微信小程序七日谈>系列文章: 第一天:人生若只如初见: 第二天:你可能要抛弃原来的响应式开发思维: 第三天:玩转Page组件的生命周期: 第四天:页面路径最多五层?导航可以这么玩 微信小 ...

随机推荐

  1. ajax jsonp的跨域请求

    1.页面ajax的请求 $.ajax({ async: false, url: 'http://localhost:8080/downloadVideos',//跨域的dns/document!sea ...

  2. apache2.2 +php7.3安装 编译安装

    1.下载 http://archive.apache.org/dist/httpd/httpd-2.2.0.tar.gz tar -xvf httpd-2.2.0.tar.gz 2.安装 ./conf ...

  3. 【Zookeeper】Zookeeper集群单节点提供服务

    以下只在特殊情况下使用,不要用在生产环境. 一.问题背景 公司的产品使用Zookeeper做为集群支持,但是客户在验收的时候提出了一个很为难人的要求,那就是3台集群服务,停止2台以后,还要求我们的应用 ...

  4. 【python】字典/dictionary操作

    字典(dictionary) 字典是另一种可变容器模型,且可存储任意类型对象. 字典的每个键值 key=>value 对用冒号:分割,每个键值对之间用逗号,分割,整个字典包括在花括号 {} 中 ...

  5. LeetCode题解之Convert BST to Greater Tree

    1.题目描述 2.问题分析 使用一个vector将所有节点的值以升序排列.然后比较,求和,加上. 3.代码 TreeNode* convertBST(TreeNode* root) { if (roo ...

  6. 用 Windows Live Writer 写blog,This is Test……..

    1.下载  Windows Live Writer,百度一下下载地址,不在这里提供下载了. 2.选择安装,其它微软应用不需要就不要安装. 3.里面有很多用的插件很好玩的,点击添加插件.

  7. percona pt toolkit 总结

    ##=====================================================##pt-osc之工作流程:1.检查更改表是否有主键或唯一索引,是否有触发器2.检查修改表 ...

  8. Yearning v1.3.0 发布,Web 端 SQL 审核平台

    企业级MYSQL web端 SQL审核平台. Website 官网 www.yearning.io Feature 功能 数据库字典自动生成 SQL查询 查询工单 导出 自动补全,智能提示 查询语句审 ...

  9. 事务的ACID性质

    最近在读黄健宏的<Redis设计与实现>,现在看到了事务这章,由于之前(上学)没有好好整理过数据库事务的四大性质,导致现在(工作)看到了就和第一次知道一样((lll¬ω¬)).还是要把基础 ...

  10. JAVA JComboBox的监听事件(ActionListener、ItemListener)

    版权声明:本文为博主原创文章,未经博主允许不得转载.   目录(?)[+]   参考资料: http://263229365.iteye.com/blog/1040329 https://www.ja ...