사용자가 버튼을 누를 때마다 섹션의 항목 수에 1을 더하고 싶지만 코드에 어떻게 써야하는지 잘 모릅니다.Xcode Swift Collection보기 : 버튼을 누를 때마다 섹션의 항목 수를 어떻게 추가 할 수 있습니까?
@IBAction func myButton(_ sender: Any) {
let numberOfItemsInSection + 1 //What's the correct way to write this line of code?
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return 0 // +1 whenever the button gets tapped
}
변수를 사용하고 numberOfItemsInSection' 기능'에 반환 ... 단 하나에게 다음을 추가하고 테이블을 – Tj3n