Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

通过xib采用自动布局,宽度计算有问题 #39

Open
yanghl opened this issue Jan 16, 2018 · 5 comments
Open

通过xib采用自动布局,宽度计算有问题 #39

yanghl opened this issue Jan 16, 2018 · 5 comments

Comments

@yanghl
Copy link

yanghl commented Jan 16, 2018

举例:采用xib布局, 通过在一个cell上放一个view 继承自 NewPagedFlowView ,,上下左右约束都设为0 如果这个xib 的可视界面的宽度为500 那么你的 NewPagedFlowView竟然在任何机型上都是按照500来计算的,,这个很坑啊,,用该是采用 这个cell在具体机型上实际的宽度计算呀

@PageGuo
Copy link
Owner

PageGuo commented Jan 16, 2018

xib布局会冲突,建议代码写

@yanghl
Copy link
Author

yanghl commented Jan 16, 2018

其实 在 NewPagedFlowView 加上 下面代码就可以了,,

-(void)layoutSubviews{
[super layoutSubviews];
[self reloadData];
}

@PageGuo
Copy link
Owner

PageGuo commented Jan 16, 2018

layoutSubviews之前很多逻辑写在这里,你测试好,别出其他问题就好了~

@yanghl
Copy link
Author

yanghl commented Jan 16, 2018

我提供的方式 虽然可以,,但是不合理呀,,,希望你优化一下啊,,,只需把 frame相关的代码 提到layoutSubviews中 即可,,

@SeanJohn1024
Copy link

确实是个大坑 开始以为是xib自动适配的代码问题 结果删了还是一样 。。。。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants