`
xumingrencai
  • 浏览: 1177393 次
文章分类
社区版块
存档分类
最新评论

XCode 6 , IOS 8 中使用 use size classes 的时候 自动调整 自定义table cell的宽度

 
阅读更多

转自:http://blog.csdn.net/remote_roamer/article/details/40190465

在xcode 6 和 ios 8 中,如果使用了 use size classes 的方法来调整屏幕尺寸。

在自动调整table view 和 table cell view的时候,会出现 cell的宽度不会自动适应各种手机屏幕尺寸的问题。

解决办法:

在自定义的 table cell 类中 重写

  1. -(void)setFrame:(CGRect)frame
根据当前的设备的宽度来自动设置 cell的宽度

  1. -(void)setFrame:(CGRect)frame{
  2. frame.size.width=self.window.frame.size.width;
  3. [supersetFrame:frame];
  4. }

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics