要在CollectionView中自定义JSQPhotoMediaItem
单元格的大小,我创建了一个子类:
class CustomMediaPhoto: JSQPhotoMediaItem{
override func mediaView() -> UIView! {
return UIView()
}
override func mediaViewDisplaySize() -> CGSize {
let screen = UIScreen.mainScreen().bounds
let screenWidth = screen.size.width * 0.6
let size = CGSizeMake(screenWidth, screenWidth)
print(size)
return size
}
override func mediaPlaceholderView() -> UIView! {
return nil
}
override func mediaHash() -> UInt {
return UInt(0)
}
}
但显示单元格时存在错误(并非总是如此,我无法找到重现错误的线性方式):