EALayout 第五节 自动计算容器高度
2015-07-27 15:14
260 查看
Swift
https://github.com/easycodingTop/EALayout
Objective-C
https://github.com/easycodingTop/EALayoutLiteForOC
QQ群:454686295
====================================================
这一地讲如何自动计算高度
====================================================
![](http://img.blog.csdn.net/20150727151450994?watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQv/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center)
{
"class":"UIView",
"backgroundColor":"redColor",
"layout":{"s":"l=10,m,w,h"},
"addSubview":[
{
"class":"UIImageView",
"image":"image/testicon.jpg",
"layout":{"s":"l=10,r=10,t=20,w=80,h=80","tag":1}
},
{
"class":"UILabel",
"textColor":"blackColor",
"font":18,
"text":"这里文字可能是多行,自动计算高度",
"numberOfLines":0,
"layout":{"s":[
{"s":"l=10,r=10,b=10"},
{"s":"t=5","asstag":1}
]}
}
]
}
外层layout {"s":"l=10,m,w,h"}, 这里的w, h 当然与 w=0,h=0是两回事。
这里写 w,不给赋值,表示通过子view的布局,自动计算大小来,
h 同理。
当然这样写,你得保证 通过子view的布局,可以算出来才行。
==================================================================
敬请关注下一节:
====================================================
Swift
https://github.com/easycodingTop/EALayout
Objective-C
https://github.com/easycodingTop/EALayoutLiteForOC
QQ群:454686295
====================================================
https://github.com/easycodingTop/EALayout
Objective-C
https://github.com/easycodingTop/EALayoutLiteForOC
QQ群:454686295
====================================================
这一地讲如何自动计算高度
如何自动计算容器高度:
===================================================={
"class":"UIView",
"backgroundColor":"redColor",
"layout":{"s":"l=10,m,w,h"},
"addSubview":[
{
"class":"UIImageView",
"image":"image/testicon.jpg",
"layout":{"s":"l=10,r=10,t=20,w=80,h=80","tag":1}
},
{
"class":"UILabel",
"textColor":"blackColor",
"font":18,
"text":"这里文字可能是多行,自动计算高度",
"numberOfLines":0,
"layout":{"s":[
{"s":"l=10,r=10,b=10"},
{"s":"t=5","asstag":1}
]}
}
]
}
外层layout {"s":"l=10,m,w,h"}, 这里的w, h 当然与 w=0,h=0是两回事。
这里写 w,不给赋值,表示通过子view的布局,自动计算大小来,
h 同理。
当然这样写,你得保证 通过子view的布局,可以算出来才行。
==================================================================
敬请关注下一节:
====================================================
Swift
https://github.com/easycodingTop/EALayout
Objective-C
https://github.com/easycodingTop/EALayoutLiteForOC
QQ群:454686295
====================================================
相关文章推荐
- HDOJ-1211 RS(数论)
- Android Volley的基本用法--StringRequest以及JsonReques
- 最小二乘法
- IOS-蓝牙
- 聚焦爬虫:定向抓取系统的实现方法
- poj 1703 Find them, Catch them(种类并查集和一种巧妙的方法)
- C#高级编程五十七天----位数组
- DNS的查询方式
- 编写JQuery插件
- 1.4-shell中特殊符号
- 笔记117--AsyncTask随Activity结束而终止
- 1.3-系统和用户的环境变量配置文件
- Ajax的两种实现方式
- hdoj 1312 Red and Black【DFS】
- Ubuntu Linux 解决 bash ./ 没有那个文件或目录 的方法
- Jquery实现行内编辑
- 线程pthread_mutex_init()锁的应用
- Spring MVC 教程
- 黑马程序员--IO流(1)
- 1.2-shell变量