我想用Swift 3獲得我的collectionView
的寬度的100%,但我很困惑。我正在嘗試的方法不起作用。到目前爲止,我有:Swift 3的CGSize集合視圖的100%寬度
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
return CGSize(width: 100, height: 25)
}
任何想法?
是的,重要的是指出'CGSize(width:100,height:25)'返回大小100點* 25點。它不需要百分比作爲參數,而是要點。 – Randy
感謝那就是我所需要的。 – Sole
@Sole不要忘記接受答案。 – shallowThought