-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
QMUIButton在UITableViewCell中遇到的布局问题 #393
Comments
请把你这个界面的代码文件(viewController + cell)发送到 qmuiteam@qq.com |
文件已经发送了,可你们回复"看你的代码,好像并没有看到你 issue 里说的“让 button 的宽度跟随title的变化而变化”?",只是看并没有运行或者怎样码? |
经测试,这与以下几个因素有关:
而只要把 |
2.8.0 已修复 |
请填写运行环境
模拟器
iOS 11.4
9.4.1
2.7.6
请描述具体问题
使用Masonry布局
UITableViewCell中有一View,有一QMUIButton添加到上面,其left,top,height固定,长度根据其titleLabel.text 自适应
cell在重用过程中,QMUIButton的width正确,但是titleLabel的width会有错误。系统UIButton并无此问题。
解决办法有两种:
1.该button添加到cell.contentView上
2.修改QMUIButton的layoutSubviews方法
前者和后者 BOOL 值相同,推测前者触发了什么布局方法。
相关截图(断点的堆栈、控制台的 log)
黄色为QMUIButton 的superView,红色为QMUIButton,绿色为button.titleLabel
![2018-08-31 2 44 41](https://user-images.githubusercontent.com/34535969/44896986-b0223c00-ad2c-11e8-81a7-cdb54e1b77ad.png)
The text was updated successfully, but these errors were encountered: