Advertisement
Guest User

Untitled

a guest
Dec 21st, 2014
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. class BoatMatchingGame: UICollectionViewController, UICollectionViewDelegateFlowLayout, UICollectionViewDataSource {
  2.  
  3. override func collectionView(collectionView: UICollectionView, didSelectItemAtIndexPath indexPath: NSIndexPath) {
  4. switch indexPath.item {
  5. case 14:
  6. performSegueWithIdentifier("Quit Matching Game", sender: self)
  7. }
  8.  
  9. var cellTitle = UILabel()
  10. override func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
  11. let cell = collectionView.dequeueReusableCellWithReuseIdentifier(reuseIdentifier, forIndexPath: indexPath) as UICollectionViewCell
  12. cell.contentView.addSubview(cellTitle)
  13. switch indexPath.item {
  14. case 14:
  15. cellTitle.text = "Press to quit game. Time left: (timerText) seconds"
  16.  
  17. func startGame() {
  18. time = 45
  19. var timer = NSTimer.scheduledTimerWithTimeInterval(1.0, target: self, selector: Selector("addTime"), userInfo: nil, repeats: true)
  20. }
  21. func addTime() {
  22. --time
  23. timerText = "(time)"
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement