Comments (8)
UIView *view = [[UIView alloc] init];
view 连尺寸都没有,也没有设置约束。
from mylinearlayout.
view的尺寸随内部元素大小变动,由内部视图约束撑开
from mylinearlayout.
MyLayout对普通视图的自适应是感觉不出来的,所以造成了你的view没有尺寸。问题是你既然已经把view当做一个容器来包装imageview和label。那么为什么不将view改为一个水平先行布局呢?代码还会少很多。
from mylinearlayout.
首先,感谢您的建议。但view内的样式不固定,这里只是举了个例子,例子里图片和标签是水平左右分布,但实际开发时view内的样式并不是这样. @youngsoft
from mylinearlayout.
因为mylayout内部是用frame来实现的,所以在布局开始时如果是非布局子视图,用的不是mylayout的约束,而是用的autolayout约束的话,可能不会生效。除非autolayout约束设置完后其中的frame计算生效才可能有效。
from mylinearlayout.
使用mas确实是不行,我也是尝试过用mas撑开一个包含UILabel和Image的UIView,但是展示出来怎么都是0x0的尺寸,而对view直接mas的话,又会让linearView的布局不正确,后来使用了MyLinearLayout横纵叠加的方式并整体设置:wrapContentWidth = YES; wrapContentHeight = YES;来实现布局
from mylinearlayout.
@aiqinxuancai 你说的“MyLinearLayout横纵叠加的方式”能详细点吗?是跟 “youngsoft” 描述的一致吗?“将view改为一个水平先行布局”
from mylinearlayout.
就是子view的叠加,横的MyLinearLayout里面放纵的MyLinearLayout
from mylinearlayout.
Related Issues (20)
- uicollectview均分的问题 HOT 3
- MyFloatLayout Orientation 传递是Horz,实际的布局方向是垂直方向 HOT 1
- 设置视图的widthSize.max后,再设置widthSize.max(MyLayoutSize.empty); 导致崩溃 HOT 4
- 请问swift版本啥时候更新?还有能否做成像类似swiftui那样dsl布局形式? HOT 1
- 相对布局下, fetchLayoutSizeClass: 的一个visibility问题
- 目前 layout 中含有 selected 属性; 建议再增加一个 highlighted 属性;(有的时候需要通过监听点击事件,设置子视图的状态)
- 希望在栅格布局的中,可以通过对子视图的visibility,以实现动态布局;
- 使用MJRefresh刷新列表,结束刷新状态,UICollectionView动态计算高度有问题 HOT 2
- MyFlexLayout 嵌套 MyFlexLayout 时问题 HOT 1
- QMUIKit中的QMUIButton 使用MyLayoutSize.wrap无法自适应 HOT 1
- [崩溃] -[MyBaseLayout myValidMargin:subview:calcPos:selfLayoutSize:] HOT 2
- 希望MyRelativeLayout添加对子视图未设置布局时的 frame 的支持
- Demo中朋友圈布局抖动问题 HOT 2
- 对动画设置为0秒,completion不执行的问题 HOT 2
- 框架升级后界面无法显示 HOT 2
- 这个库还在维护吗? HOT 5
- 项目还会维护? HOT 1
- 咨询MyFlexLayout在Cell动态高度中的用法 HOT 2
- MyLinearLayout 可以在swift项目中使用吗?我看swift版本已经很久都没有维护了 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mylinearlayout.