uitableview - Xcode 6中的UITableView中的自动调整大小问题

标签 uitableview ios7 storyboard xcode6 autoresizingmask

我在UITableview的xcode 6中使用自动调整大小,但无法正常工作。我想使用自动调整大小。我从 Storyboard 中的UITableviewController类的静态单元格中添加了文本字段。屏幕外的文本字段为横向或纵向。我不想使用autolayout我的整个项目都在自动调整大小。

Demo Project

最佳答案

我最近有同样的问题。我在UITableViewCell的内容 View 中以及每次隐藏时都添加了标签(x >> 320)。我意识到问题出在源代码XML中。

XML是:

<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="InvoiceCell" rowHeight="60" id="B9T-xx-TCx" customClass="InvoiceCell"> 
    // My custom cell is 60 height
    <rect key="frame" x="0.0" y="0.0" width="320" height="44"/> 
    // Wrong Autoresizing
    <autoresizingMask key="autoresizingMask"/> 
    <tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="B9T-xx-TCx" id="nvL-MG-mGs">
        //No rect frame and wrong autoresizing mask
        <autoresizingMask key="autoresizingMask"/>

要解决我的问题,只需将“tableViewCell”和“tableViewCellContentView”更改为:
<tableViewCell contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="InvoiceCell" rowHeight="60" id="B9T-xx-TCx" customClass="InvoiceCell"> 
    //Add/change this 2 lines in <tableViewCell>
    <rect key="frame" x="0.0" y="0.0" width="320" height="60"/>
    <autoresizingMask key="autoresizingMask" widthSizable="YES"/>


<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="B9T-xx-TCx" id="nvL-MG-mGs">
    //Add/change this 2 lines in <tableViewCellContentView>
    <rect key="frame" x="0.0" y="0.0" width="320" height="60"/>
    <autoresizingMask key="autoresizingMask" widthSizable="YES"/>

所以,问题解决了!希望对您有帮助。

关于uitableview - Xcode 6中的UITableView中的自动调整大小问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26230247/

相关文章:

ios - 具有多个天气数据时间帧的 CoreData 对象建模

ios - Xcode - 如何在 Storyboard中切换 View

ios - 每次调用 ViewdidLoad

ios - 通过滑动操作更改 UIImageView 图像

ios - 我的表格 View 在滚动时重用选定的单元格——在 SWIFT 中

ios - UITableView 与搜索器并在单元格初始加载和搜索 TableView 后选择 UITableViewcell?

iOS 相当于 HTML/CSS 中的分层 div

ios - 内存警告后将 viewDidUnload 发送到已释放的实例

ios - 为什么多点连接框架发现自己是一个外国同行以及不存在的外国同行?

ios - 难以理解 Obj-C MVC : exit and unwindSegue