OC ui表示图积累难记方法
来源:互联网 发布:自媒体平台 知乎 编辑:程序博客网 时间:2024/03/28 17:03
表视图
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
在视图滚动时调用此方法,基于UIView。
contentoffset是UIScrollView的一个属性,表示当前显示视图顶点距离frame的偏移量
contentSize 表示可显示视图的大小,大小超过了frame可以通过滚动来查看,比如frame是(0,0,320,480),contentsize是(320, 1000),那scrollView的范围就是(320, 1000),超出的部分可以通过滚动来查看下面的东西
viewController写TableViewController必须继承UITableViewDataSource,UITableViewDelegate这两个协议,而且必须实现以下俩个方法cell数量和cell的设置
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
cell的数量,需要return返回
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
cell的设置,一般都固定写法- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
cell的高度,需要return返回- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
点击cell 的方法,可以推出下一个视图,可以属性传值- (void)setSelected:(BOOL)selected animated:(BOOL)animated
cell被选中的动画方法图片在cell上的自适应高度公式cell的高度= cell的宽度 *图片的高度/图片的宽度
setAccessoryTypecell的辅助视图
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath
判断能不能移动- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath
tableView中每一行移动的方法
自定义cell时
UIView初始化完以后会调用- (void)layoutSubviews方法 需要先调用父类layoutSubviews
其实的self.contentView是铺在cellView上的一层,往cell上放东西都放他上面(为了防止铺在cell上东西太多导致调用混乱)
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
section区域的数量- (NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
section的header title的名字,就是每个区域section的名字- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
标题的高度
- (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
标题的设置,每个Section区域的头- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView
侧栏的titles,就像通讯录右边的ABCD。。。- OC ui表示图积累难记方法
- OC积累(三)
- 图的表示方法
- 图的表示方法
- OC对象的表示
- OC-UI-004.纯代码编写按钮的简单方法
- C# UI积累
- 软件UI规范积累
- android ui 积累
- UI布局知识积累
- 方法积累
- 类图关系表示方法
- 图的数组表示方法
- 1、HelloWord-OC+UI
- 8、UIImageView-OC+UI
- 6、UILabel-OC+UI
- 7、UIButton-OC+UI
- 9、UIProgressView-OC+UI
- scrap安装
- MFC9.0 Outlook控件的标题显示无法修改
- Pro Android学习笔记 ActionBar(1):Home图标区
- STL 容器类基本操作
- windows系统查看端口号,杀死进程
- OC ui表示图积累难记方法
- C#如何更新DataGridView中的数据?
- ftp4j 实现 上传下载 代理 断点续传
- 杂谈
- 提笔
- 黑暗中前行
- 似水人生
- 漫游诗境
- 往昔