swift 在Xcode 6 GM + iOS 7.1中修复UICollectionViewCell损坏的自动布局约束

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了swift 在Xcode 6 GM + iOS 7.1中修复UICollectionViewCell损坏的自动布局约束相关的知识,希望对你有一定的参考价值。

//
// Created by James Tang @jamztang
// https://gist.github.com/jamztang/68c3e16d071a01db81cf
//
// Credit goes to https://stackoverflow.com/questions/25753373/ios-8-gm-does-not-update-constraints-on-collection-views/25768375#25768375
//

import UIKit

class BaseCollectionViewCell: UICollectionViewCell {

    override var bounds : CGRect {
        didSet {
            // Fix autolayout constraints broken in Xcode 6 GM + iOS 7.1
            self.contentView.frame = bounds
        }
    }

}

以上是关于swift 在Xcode 6 GM + iOS 7.1中修复UICollectionViewCell损坏的自动布局约束的主要内容,如果未能解决你的问题,请参考以下文章