iOS笔记 Collection View Controller
来源:互联网 发布:民乐队服装大全淘宝 编辑:程序博客网 时间:2024/05/18 05:02
1.tag属性
1.1 UIView的属性
所有的视图、控件都有
1.2 作用:
标识父视图中的子视图,给每一个子视图一个唯一的编号
如此,就可以从父视图中获取指定tag值的那个子视图
self.view (父视图)
UILabel *label1 = @"";
UILabel *label2 = @"";
label1.tag = 1;
label2.tag = 2;
在别的方法中:
[self.view viewWithTag:1];//拿到label1
[self.view viewWithTag:2];//拿到label2
2. UITableViewController中的数据模型
1) 对象
+ TVC
+contact : TRContact
每一行,显示此对象的一个属性
用于静态的TableView
2) 数组-->NSString
+ TVC
+ data : NSArray
+ [item] : NSString
每一行,显示数组中一个字符串
普通的用法
3)数组-->对象
+ TVC
+ data : NSArray
+ [item] : TRContact
每一行显示一个对象,可以显示对象中的多个属性
4) 数组中-->对象-->数组
+ TVC
+data : NSArray
+ [item] : TRArea
+ subArea : NSArray
多分区显示
多TVC显示
5)展示多层结构
数据结构:
+ area: TRArea
+name : NSString
+ subAreas : NSArray
+[item] : TRArea
+name : NSString
+subAreas : NSArray
。。。
树状结构的数据模型
[Demo1] TVC
3. Collection View Controller(集合视图控制器)
3.1 版本 iOS6开始才有
3.2 用处
是一个视图控制器,类似TableViewController, 可以摆放大量重复的有格式的视图 Flow Layout布局是默认布局
3.3 本质
TableViewController 的变异
UICollectionViewController UITableViewController
UICollectionView UITableView
UICollectionViewDelegate UITableViewDelegate
UICollectionViewDataSource UITableVIewDataSource
三问一响应:
section
item
cell : UICollectionViewCell
[Demo2]
CollectionViewCell 肯定是自定义
1> 创建CollectionViewController 带xib
2> xib中的View改成UICollectionView
3> 设置UICollectionView中的相关属性
4> 自定义Cell:
1> 创建Cell类
2> 创建Cell的xib
3> xib中拖拽一个UICollectionViewCell
4> 对xib中的Cell进行设置,并将其绑定到类
5> 注册Cell
6> 三问一响应
和TableView对照学习
4. UITabBarController(标签视图控制器)
4.1 是什么
类似于UINavigationController, 是一个控制器的控制器
4.2 如何使用
window.rootViewController = UITabBarController
UITabBarController.viewControllers = @[navi1, navi2, navi3];
window包含TabBar, TabBar又包含Navigation
4.3 配置属性:
.title
.tabBarItem
[Demo3]
4.4 和Navi混合使用
tabbar包Navi, Navi包普通VC
界面跳转:
present:
新界面不会出现tabbar
push:
界面会保留tabbar
.hidesBottomBarWhenPushed = YES就可以隐藏tabbar
5.补充控件
UIPickerView UIDatePickerView UIWebView UISegmentedControl UIProgressView UITextView
UIActivityIndicatorView
5.1 UISegmentedControl
重要属性:
.numbersOfSegments;//有多少个segment
.selectedSegmentIndex;//用户选择了哪个segment
5.2 UIActivityIndicatorView
重要方法:
startAnimation, stopAnimation
5.3 UIProgressView 进度条
.progress (0.0~1.0)
5.4 UITextView(多行文本框)
相对于UITextField(单行文本框)
.text
5.5 UIDatePickerView
.date属性
5.6 UIPickerView
作业:
1. 完成一个老虎机的游戏
2. 使用CollectionViewController做一个图片浏览器
- iOS笔记 Collection View Controller
- Collection View Controller的使用
- 《View Controller Programming Guide for iOS》笔记
- 《View Controller Programming Guide for iOS》笔记
- 《View Controller Programming Guide for iOS》笔记
- View Controller Programming Guid for iOS 笔记
- ios 初学者笔记3: view controller
- View Controller Programming Guid for iOS 笔记
- iOS Storyboards Container View Controller整理笔记
- iOS view controller 生命周期
- collection View学习笔记
- 六 view controller 笔记
- iOS学习笔记02—View Controller的生命周期
- iOS学习笔记02—View Controller的生命周期
- IOS 开发 View Controller 综述
- IOS中的Model-View-Controller
- IOS Present View Controller 详解
- iOS—Model,Controller,View
- iis配置的网站,打开后弹出要输入用户名和密码的窗口
- js 与或运算符 || && 妙用
- 网络资源总结的一些在Java编程中尽可能要做到的一些地
- C#学习笔记5
- 【石子合并】_DP
- iOS笔记 Collection View Controller
- 腾讯的新闻称中国老头三天破解世界最难九宫格
- 为什么要用RMI
- 加盐哈希-Salted Password Hashing
- hdu4768 非常规的二分
- 一种是InputStream/OutputStream
- os实验
- 覆盖了equals()和hashCode()方法以确保两个相等映射返回相同的哈希码
- 实现接口的函数可以虚函数 抽象函数