转自:http://blog.youkuaiyun.com/remote_roamer/article/details/40190465
在xcode 6 和 ios 8 中,如果使用了 use size classes 的方法来调整屏幕尺寸。
在自动调整table view 和 table cell view的时候,会出现 cell的宽度不会自动适应各种手机屏幕尺寸的问题。
解决办法:
在自定义的 table cell 类中 重写
- -(void)setFrame:(CGRect)frame
- -(void)setFrame:(CGRect)frame{
- frame.size.width=self.window.frame.size.width;
- [supersetFrame:frame];
- }
本文介绍了解决iOS 8中使用size classes时TableView Cell宽度无法自适应屏幕尺寸的问题。通过在自定义Cell类中重写setFrame方法,并根据当前设备宽度设置Cell宽度,实现不同屏幕尺寸下的自适应。
69

被折叠的 条评论
为什么被折叠?



