我无法让这个工作。当我拉我的头发时,有没有人有任何想法。
import UIKit
private let reuseIdentifier = "CardViewCell"
class GameViewController: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource {
var collectionData = ["image2", "image2", "image2", "image2", "image2", "image2", "image2", "image2", "image2", "image2", "image2", "image2", "image2", "image2", "image2", "image2"]
@IBOutlet weak var collectionView: UICollectionView!
override func viewDidLoad() {
super.viewDidLoad()
collectionView.delegate = self
collectionView.dataSource = self
// Set up the 4x4 grid
let width = (view.frame.size.width - 60) / 4
let layout = collectionView.collectionViewLayout as! UICollectionViewFlowLayout
layout.itemSize = CGSize(width: width, height: width)
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
collectionView.reloadData()
}
// MARK: UICollectionViewDataSource
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return collectionData.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: reuseIdentifier, for: indexPath) as! CardViewCell
cell.cardImage.image = UIImage(named: collectionData[indexPath.row])
return cell
}
func collectionView(_ collectionView: UICollectionView, didDeselectItemAt indexPath: IndexPath) {
let cell = collectionView.cellForItem(at: indexPath) as! CardViewCell
let selectedImage = collectionData[indexPath.item]
cell.flipCardAction(selectedImage)
}
}
答案 0 :(得分:0)
试试这个,它会起作用
If V30 = 1 Then
V40 = "Condition met"
ElseIf V30 = 2 Then
V40 = "Condition not met"
Else
V40 = ""
End If