Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class BoatMatchingGame: UICollectionViewController, UICollectionViewDelegateFlowLayout, UICollectionViewDataSource {
- override func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
- switch indexPath.item {
- case 14:
- performSegueWithIdentifier("Quit Matching Game", sender: self)
- }
- var cellTitle = UILabel()
- override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
- let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath) as UICollectionViewCell
- cell.contentView.addSubview(cellTitle)
- switch indexPath.item {
- case 14:
- cellTitle.text = "Press to quit game. Time left: (timerText) seconds"
- func startGame() {
- time = 45
- var timer = NSTimer.scheduledTimerWithTimeInterval(1.0, target: self, selector: Selector("addTime"), userInfo: nil, repeats: true)
- }
- func addTime() {
- --time
- timerText = "(time)"
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement