我有一个名为ChronicleCell
的UICollectionViewCell
自定义类。将UIButton设置为UICollectionViewCell的大小
我正在创建一个类型为UIButton
的实例变量。
class ChronicleCell : UICollectionViewCell {
//init etc.
var buttonFullCellSize : UIButton = {
let button = UIButton()
//TODO set button to be size of UICollectionViewCell frame
}()
}
对于此实例变量,我想设置其帧等同于UICollectionViewCell
的帧。但是,从UICollectionViewCell
继承的类中无法访问。我怎样才能做到这一点?谢谢!
你看过访问'self.contentView'获取单元格的所有大小信息? –