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组件的生命周期: 第四天:页面路径最多五层?导航可以这么玩 微信小 ...
随机推荐
- vue 笔记
<div id="root"> <div> <input v-model="inputValue" /> <butto ...
- 【代码笔记】iOS-自定义loading
一,效果图. 二,工程图. 三, 代码. ViewController.h #import <UIKit/UIKit.h> //loading #import "GPLoadin ...
- EasyUI 通过 Combobox 实现 AutoComplete 效果
朋友在做一个web程序,用的EasyUI框架,让我帮忙实现一个自动提示功能.由于之前我也没用过EasyUI框架,就想到了jQueryUI有 AutoComplete 插件,就想直接拿过来用. 但当我将 ...
- 语义SLAM的数据关联和语义定位(四)多目标测量概率模型
多目标模型 这部分想讲一下Semantic Localization Via the Matrix Permanent这篇文章的多目标测量概率模型.考虑到实际情况中,目标检测算法从单张图像中可能检测出 ...
- mysql的又一个让人捉摸不透的bug?
这次就不说很多没有写博客了,因为前几天已经写过了.\^o^/ 昨天我们刚讨论了关于自动化运维工作的实现方式,如果批量执行,中间出错怎么办?突然有人提出mysql支持--force,可以跳过出错继续执行 ...
- 缓存那些事-zz
https://tech.meituan.com/cache_about.html 前言 一般而言,现在互联网应用(网站或App)的整体流程,可以概括如图1所示,用户请求从界面(浏览器或App界面)到 ...
- 获取本机正在使用的ipv4地址(访问互联网的IP)
[转]原文地址:http://www.cnblogs.com/lijianda/p/6604651.html 1.一个电脑有多个网卡,有线的.无线的.还有vmare虚拟的两个网卡.2.就算只有一个网卡 ...
- Netstat Commands for Linux Network Management
netstat (network statistics) is a command line tool for monitoring network connections both incoming ...
- 天河2号-保持使用yhrun/srun时连接不中断 (screen 命令教程 )
问题重述: 当我们使用天河机进行并行程序实验的时候,都会使用到yhrun/srun命令.在超算环境下,yhrun 命令用来进行提交交互式作业,有屏幕输出.但是容易受到网络波动影响导致断网或者关闭窗口最 ...
- SQL 的各种 join 用法
作者丨C.L. Moffatt http://www.codeproject.com/Articles/33052/Visual-Representation-of-SQL-Joins I am go ...