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. 【代码笔记】iOS-字体从右向左滚动

    一,效果图. 二,代码. ViewController.m - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup ...

  2. [iOS] 列表滑动展开隐藏头部HeaderView

    平常遇到大多数的带有列表的应用都会遇到这个场景:在列表顶端有一个Header,当向上滑动列表时,压缩header,向下滑动列表到头时,展开header.这种样式在例如微博,twitter这些展示动态的 ...

  3. MAYA逼真手枪制作视频教程 中文字幕

    下载地址 更多中文字幕教程请关注微镜映画网,有各类CG教程提供

  4. 重学C语言---05运算符、表达式和语句

    一.循环简介 实例程序 /*shoes1.c--把一双鞋的尺码变为英寸*/#include <stdio.h>#define ADJUST 7.64#define SCALE 0.325 ...

  5. ionic默认样式android和ios差异

    ionicframework中android和ios在默认样式上有一些不同的地方,官方文档中都有说明,但是经常会想不起. 一.差异: 1.tab位置,$ionicConfigProvider, tab ...

  6. c# 为什么要使用Array、ArrayList、List?

    c#也是一直在进化的,从数组进化到ArrayList,再进化到泛型就是个例子. static void Main(string[] args) { //数组的增删改查 //定义数组 ] { ,,,, ...

  7. [Python_4] Python 面向对象(OOP)

    0. 说明 Python 面向对象(OOP) 笔记.迭代磁盘文件.析构函数.内置方法.多重继承.异常处理 参考 Python面向对象 1. 面向对象 # -*-coding:utf-8-*- &quo ...

  8. 乘风破浪:LeetCode真题_033_Search in Rotated Sorted Array

    乘风破浪:LeetCode真题_033_Search in Rotated Sorted Array 一.前言     将传统的问题进行一些稍微的变形,这个时候我们可能无所适从了,因此还是实践出真知, ...

  9. 第 14 章 结构和其他数据形式(names)

    *--------------------------------- names1.c -- 使用指向结构的指针 ---------------------------------*/ #includ ...

  10. 张高兴的 .NET Core IoT 入门指南:(一)环境配置、Blink、部署

    如何在 Raspberry Pi 的 Raspbian 上构建使用 GPIO 引脚的 IoT 程序?你可能会回答使用 C++ 或 Python 去访问 Raspberry Pi 的引脚.现在,C# 程 ...