From 46eb7477375c0eddf1987664b23025732d5c4416 Mon Sep 17 00:00:00 2001 From: Riley Testut Date: Sat, 26 Dec 2015 04:09:45 -0600 Subject: [PATCH] Replaced GameCollectionViewLayout with GridCollectionViewLayout Additionally, refactored GridCollectionViewCell to no longer use a NIB. This makes it easier to reuse for iOS and tvOS, and allows us to use storyboard segues (which include peek & pop) --- .../GameCollectionViewCell.swift | 137 ------------------ .../GameCollectionViewDataSource.swift | 25 ++-- .../GameCollectionViewLayout.swift | 113 --------------- .../GameCollectionViewLayoutAttributes.swift | 32 ---- .../GridCollectionViewCell.swift | 54 +++++-- .../GridCollectionViewLayout.swift | 0 Cores/DeltaCore | 2 +- Cores/SNESDeltaCore | 2 +- Delta.xcodeproj/project.pbxproj | 51 ++----- Delta/Base.lproj/Main.storyboard | 10 +- .../GamesCollectionViewController.swift | 10 +- .../GridCollectionViewCell.xib | 51 ------- Delta/Pause Menu/PauseViewController.swift | 8 +- DeltaTV/Base.lproj/Main.storyboard | 14 +- DeltaTV/GameSelectionViewController.swift | 14 +- 15 files changed, 100 insertions(+), 423 deletions(-) delete mode 100644 Common/Collection View/GameCollectionViewCell.swift delete mode 100644 Common/Collection View/GameCollectionViewLayout.swift delete mode 100644 Common/Collection View/GameCollectionViewLayoutAttributes.swift rename {Delta/Pause Menu => Common}/Collection View/GridCollectionViewCell.swift (62%) rename {Delta/Pause Menu => Common}/Collection View/GridCollectionViewLayout.swift (100%) delete mode 100644 Delta/Pause Menu/Collection View/GridCollectionViewCell.xib diff --git a/Common/Collection View/GameCollectionViewCell.swift b/Common/Collection View/GameCollectionViewCell.swift deleted file mode 100644 index 3e8707a..0000000 --- a/Common/Collection View/GameCollectionViewCell.swift +++ /dev/null @@ -1,137 +0,0 @@ -// -// GameCollectionViewCell.swift -// Delta -// -// Created by Riley Testut on 10/21/15. -// Copyright © 2015 Riley Testut. All rights reserved. -// - -import UIKit - -class GameCollectionViewCell: UICollectionViewCell -{ - let imageView = BoxArtImageView() - let nameLabel = UILabel() - - private var maximumBoxArtSize: CGSize = CGSize(width: 100, height: 100) { - didSet - { - self.imageViewWidthConstraint.constant = self.maximumBoxArtSize.width - self.imageViewHeightConstraint.constant = self.maximumBoxArtSize.height - - self.nameLabelVerticalSpacingConstraint.constant = self.maximumBoxArtSize.height / 20.0 - self.nameLabelFocusedVerticalSpacingConstraint?.constant = self.maximumBoxArtSize.height / 20.0 - - } - } - - private var imageViewWidthConstraint: NSLayoutConstraint! - private var imageViewHeightConstraint: NSLayoutConstraint! - - private var nameLabelBottomAnchorConstraint: NSLayoutConstraint! - - private var nameLabelVerticalSpacingConstraint: NSLayoutConstraint! - private var nameLabelFocusedVerticalSpacingConstraint: NSLayoutConstraint? - - override init(frame: CGRect) - { - super.init(frame: frame) - - self.configureSubviews() - } - - required init?(coder aDecoder: NSCoder) - { - super.init(coder: aDecoder) - - self.configureSubviews() - } - - private func configureSubviews() - { - // Fix super annoying Unsatisfiable Constraints message in debugger - self.contentView.translatesAutoresizingMaskIntoConstraints = false - - self.imageView.translatesAutoresizingMaskIntoConstraints = false - self.contentView.addSubview(self.imageView) - - self.nameLabel.translatesAutoresizingMaskIntoConstraints = false - self.nameLabel.font = UIFont.boldSystemFontOfSize(12) - self.nameLabel.textAlignment = .Center - self.nameLabel.numberOfLines = 0 - self.contentView.addSubview(self.nameLabel) - - - // Auto Layout - - self.imageView.leadingAnchor.constraintEqualToAnchor(self.contentView.leadingAnchor).active = true - self.imageView.trailingAnchor.constraintEqualToAnchor(self.contentView.trailingAnchor).active = true - self.imageView.topAnchor.constraintEqualToAnchor(self.contentView.topAnchor).active = true - - let verticalSpacingConstant = self.maximumBoxArtSize.height / 20.0 - - self.nameLabelVerticalSpacingConstraint = self.nameLabel.topAnchor.constraintEqualToAnchor(self.imageView.bottomAnchor, constant: verticalSpacingConstant) - - #if os(tvOS) - - self.nameLabelVerticalSpacingConstraint.active = false - - self.nameLabelFocusedVerticalSpacingConstraint = self.nameLabel.topAnchor.constraintEqualToAnchor(self.imageView.focusedFrameGuide.bottomAnchor, constant: verticalSpacingConstant) - self.nameLabelFocusedVerticalSpacingConstraint?.active = true - #else - self.nameLabelVerticalSpacingConstraint.active = true - #endif - - self.nameLabel.leadingAnchor.constraintEqualToAnchor(self.contentView.leadingAnchor).active = true - self.nameLabel.trailingAnchor.constraintEqualToAnchor(self.contentView.trailingAnchor).active = true - - self.nameLabelBottomAnchorConstraint = self.nameLabel.bottomAnchor.constraintEqualToAnchor(self.contentView.bottomAnchor) - self.nameLabelBottomAnchorConstraint.active = true - - self.imageViewWidthConstraint = self.imageView.widthAnchor.constraintEqualToConstant(self.maximumBoxArtSize.width) - self.imageViewWidthConstraint.active = true - - self.imageViewHeightConstraint = self.imageView.heightAnchor.constraintEqualToConstant(self.maximumBoxArtSize.height) - self.imageViewHeightConstraint.active = true - } - - override func applyLayoutAttributes(layoutAttributes: UICollectionViewLayoutAttributes) - { - guard let attributes = layoutAttributes as? GameCollectionViewLayoutAttributes else { return } - - self.maximumBoxArtSize = attributes.maximumBoxArtSize - } - - override func didUpdateFocusInContext(context: UIFocusUpdateContext, withAnimationCoordinator coordinator: UIFocusAnimationCoordinator) - { - super.didUpdateFocusInContext(context, withAnimationCoordinator: coordinator) - - coordinator.addCoordinatedAnimations({ - - if context.nextFocusedView == self - { - self.nameLabelBottomAnchorConstraint?.active = false - self.nameLabelVerticalSpacingConstraint.active = false - - self.nameLabelFocusedVerticalSpacingConstraint?.active = true - - self.nameLabel.textColor = UIColor.whiteColor() - - } - else - { - self.nameLabelFocusedVerticalSpacingConstraint?.active = false - - self.nameLabelBottomAnchorConstraint?.active = true - self.nameLabelVerticalSpacingConstraint.active = true - - self.nameLabel.textColor = UIColor.blackColor() - } - - self.layoutIfNeeded() - - }, completion: nil) - } - - -} diff --git a/Common/Collection View/GameCollectionViewDataSource.swift b/Common/Collection View/GameCollectionViewDataSource.swift index 84deac4..a078bbb 100644 --- a/Common/Collection View/GameCollectionViewDataSource.swift +++ b/Common/Collection View/GameCollectionViewDataSource.swift @@ -18,10 +18,13 @@ class GameCollectionViewDataSource: NSObject } } - var cellConfigurationHandler: ((GameCollectionViewCell, Game) -> Void)? + var cellConfigurationHandler: ((GridCollectionViewCell, Game) -> Void)? private(set) var fetchedResultsController: NSFetchedResultsController = NSFetchedResultsController() - private let prototypeCell = GameCollectionViewCell(frame: CGRectZero) + + private var prototypeCell = GridCollectionViewCell() + + private var _registeredCollectionViewCells = false // MARK: - Update - @@ -69,7 +72,7 @@ class GameCollectionViewDataSource: NSObject // MARK: - Collection View - - private func configureCell(cell: GameCollectionViewCell, forIndexPath indexPath: NSIndexPath) + private func configureCell(cell: GridCollectionViewCell, forIndexPath indexPath: NSIndexPath) { let game = self.fetchedResultsController.objectAtIndexPath(indexPath) as! Game @@ -95,7 +98,7 @@ extension GameCollectionViewDataSource: UICollectionViewDataSource func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell { - let cell = collectionView.dequeueReusableCellWithReuseIdentifier("GameCell", forIndexPath: indexPath) as! GameCollectionViewCell + let cell = collectionView.dequeueReusableCellWithReuseIdentifier("GameCell", forIndexPath: indexPath) as! GridCollectionViewCell self.configureCell(cell, forIndexPath: indexPath) @@ -107,15 +110,17 @@ extension GameCollectionViewDataSource: UICollectionViewDelegate { func collectionView(collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAtIndexPath indexPath: NSIndexPath) -> CGSize { - if let layoutAttributes = collectionViewLayout.layoutAttributesForItemAtIndexPath(indexPath) - { - self.prototypeCell.applyLayoutAttributes(layoutAttributes) - } + let collectionViewLayout = collectionView.collectionViewLayout as! GridCollectionViewLayout + + let widthConstraint = self.prototypeCell.contentView.widthAnchor.constraintEqualToConstant(collectionViewLayout.itemWidth) + widthConstraint.active = true self.configureCell(self.prototypeCell, forIndexPath: indexPath) - self.prototypeCell.layoutIfNeeded() - let size = self.prototypeCell.systemLayoutSizeFittingSize(UILayoutFittingCompressedSize) + let size = self.prototypeCell.contentView.systemLayoutSizeFittingSize(UILayoutFittingCompressedSize) + + widthConstraint.active = false + return size } } diff --git a/Common/Collection View/GameCollectionViewLayout.swift b/Common/Collection View/GameCollectionViewLayout.swift deleted file mode 100644 index 41720a7..0000000 --- a/Common/Collection View/GameCollectionViewLayout.swift +++ /dev/null @@ -1,113 +0,0 @@ -// -// GameCollectionViewLayout.swift -// Delta -// -// Created by Riley Testut on 10/24/15. -// Copyright © 2015 Riley Testut. All rights reserved. -// - -import UIKit - -class GameCollectionViewLayout: UICollectionViewFlowLayout -{ - var maximumBoxArtSize = CGSize(width: 100, height: 100) { - didSet - { - self.invalidateLayout() - } - } - - override class func layoutAttributesClass() -> AnyClass - { - return GameCollectionViewLayoutAttributes.self - } - - override func layoutAttributesForItemAtIndexPath(indexPath: NSIndexPath) -> UICollectionViewLayoutAttributes? - { - // Need to implement this method as well in case the view controller calls it (which it does) - - let layoutAttributes = super.layoutAttributesForItemAtIndexPath(indexPath)?.copy() as! GameCollectionViewLayoutAttributes - self.configureLayoutAttributes(layoutAttributes) - - return layoutAttributes - } - - override func layoutAttributesForElementsInRect(rect: CGRect) -> [UICollectionViewLayoutAttributes]? - { - guard let collectionView = self.collectionView else { return nil } - - let maximumItemsPerRow = floor((collectionView.bounds.width - self.minimumInteritemSpacing) / (self.maximumBoxArtSize.width + self.minimumInteritemSpacing)) - let interitemSpacing = (collectionView.bounds.width - maximumItemsPerRow * self.maximumBoxArtSize.width) / (maximumItemsPerRow + 1) - - self.sectionInset = UIEdgeInsets(top: interitemSpacing, left: interitemSpacing, bottom: interitemSpacing, right: interitemSpacing) - - let layoutAttributes = super.layoutAttributesForElementsInRect(rect)?.map({ $0.copy() }) as! [GameCollectionViewLayoutAttributes] - - var minimumY: CGFloat? = nil - var maximumY: CGFloat? = nil - var tempLayoutAttributes: [GameCollectionViewLayoutAttributes] = [] - - for (index, attributes) in layoutAttributes.enumerate() - { - // Ensure equal spacing between items (that also match the section insets) - if index > 0 - { - let previousLayoutAttributes = layoutAttributes[index - 1] - - if abs(attributes.frame.minX - self.sectionInset.left) > 1 - { - attributes.frame.origin.x = previousLayoutAttributes.frame.maxX + interitemSpacing - } - } - - self.configureLayoutAttributes(attributes) - - if let maxY = maximumY, minY = minimumY - { - // If attributes.frame.minY is greater than maximumY, then it is a new row - // In this case, we need to align all the previous tempLayoutAttributes to the same Y-value - if attributes.frame.minY > maxY - { - for tempAttributes in tempLayoutAttributes - { - tempAttributes.frame.origin.y = minY - } - - // Reset tempLayoutAttributes - tempLayoutAttributes.removeAll() - minimumY = nil - maximumY = nil - } - } - - if minimumY == nil || attributes.frame.minY < minimumY! - { - minimumY = attributes.frame.minY - } - - if maximumY == nil || attributes.frame.maxY > maximumY! - { - maximumY = attributes.frame.maxY - } - - tempLayoutAttributes.append(attributes) - } - - // Handle the remaining tempLayoutAttributes - if let minimumY = minimumY - { - for tempAttributes in tempLayoutAttributes - { - tempAttributes.frame.origin.y = minimumY - } - } - - return layoutAttributes - } - - // You'd think you could just do this in layoutAttributesForItemAtIndexPath, but alas layoutAttributesForElementsInRect does not call that method :( - private func configureLayoutAttributes(layoutAttributes: GameCollectionViewLayoutAttributes) - { - layoutAttributes.maximumBoxArtSize = self.maximumBoxArtSize - } -} diff --git a/Common/Collection View/GameCollectionViewLayoutAttributes.swift b/Common/Collection View/GameCollectionViewLayoutAttributes.swift deleted file mode 100644 index c4b1d0f..0000000 --- a/Common/Collection View/GameCollectionViewLayoutAttributes.swift +++ /dev/null @@ -1,32 +0,0 @@ -// -// GameCollectionViewLayoutAttributes.swift -// Delta -// -// Created by Riley Testut on 10/28/15. -// Copyright © 2015 Riley Testut. All rights reserved. -// - -import UIKit - -class GameCollectionViewLayoutAttributes: UICollectionViewLayoutAttributes -{ - var maximumBoxArtSize = CGSize(width: 100, height: 100) - - override func copyWithZone(zone: NSZone) -> AnyObject - { - let copy = super.copyWithZone(zone) as! GameCollectionViewLayoutAttributes - copy.maximumBoxArtSize = self.maximumBoxArtSize - - return copy - } - - override func isEqual(object: AnyObject?) -> Bool - { - guard super.isEqual(object) else { return false } - guard let attributes = object as? GameCollectionViewLayoutAttributes else { return false } - - guard CGSizeEqualToSize(self.maximumBoxArtSize, attributes.maximumBoxArtSize) else { return false } - - return true - } -} diff --git a/Delta/Pause Menu/Collection View/GridCollectionViewCell.swift b/Common/Collection View/GridCollectionViewCell.swift similarity index 62% rename from Delta/Pause Menu/Collection View/GridCollectionViewCell.swift rename to Common/Collection View/GridCollectionViewCell.swift index b6d1879..8906bd3 100644 --- a/Delta/Pause Menu/Collection View/GridCollectionViewCell.swift +++ b/Common/Collection View/GridCollectionViewCell.swift @@ -10,8 +10,8 @@ import UIKit class GridCollectionViewCell: UICollectionViewCell { - @IBOutlet private(set) var imageView: UIImageView! - @IBOutlet private(set) var textLabel: UILabel! + let imageView = UIImageView() + let textLabel = UILabel() var maximumImageSize: CGSize = CGSize(width: 100, height: 100) { didSet { @@ -19,21 +19,36 @@ class GridCollectionViewCell: UICollectionViewCell } } - @IBOutlet private var imageViewWidthConstraint: NSLayoutConstraint! - @IBOutlet private var imageViewHeightConstraint: NSLayoutConstraint! + private var imageViewWidthConstraint: NSLayoutConstraint! + private var imageViewHeightConstraint: NSLayoutConstraint! - @IBOutlet private var textLabelBottomAnchorConstraint: NSLayoutConstraint! + private var textLabelBottomAnchorConstraint: NSLayoutConstraint! - @IBOutlet private var textLabelVerticalSpacingConstraint: NSLayoutConstraint! + private var textLabelVerticalSpacingConstraint: NSLayoutConstraint! private var textLabelFocusedVerticalSpacingConstraint: NSLayoutConstraint? - override func awakeFromNib() + override init(frame: CGRect) { - super.awakeFromNib() + super.init(frame: frame) + self.configureSubviews() + } + + required init?(coder aDecoder: NSCoder) + { + super.init(coder: aDecoder) + + self.configureSubviews() + } + + private func configureSubviews() + { // Fix super annoying Unsatisfiable Constraints message in debugger by setting autoresizingMask self.contentView.autoresizingMask = [.FlexibleWidth, .FlexibleHeight] + self.clipsToBounds = false + self.contentView.clipsToBounds = false + self.imageView.translatesAutoresizingMaskIntoConstraints = false #if os(tvOS) self.imageView.adjustsImageWhenAncestorFocused = true @@ -48,15 +63,36 @@ class GridCollectionViewCell: UICollectionViewCell // Auto Layout + self.imageView.topAnchor.constraintEqualToAnchor(self.contentView.topAnchor).active = true + self.imageView.centerXAnchor.constraintEqualToAnchor(self.contentView.centerXAnchor).active = true + + self.imageViewWidthConstraint = self.imageView.widthAnchor.constraintEqualToConstant(self.maximumImageSize.width) + self.imageViewWidthConstraint.active = true + + self.imageViewHeightConstraint = self.imageView.heightAnchor.constraintEqualToConstant(self.maximumImageSize.height) + self.imageViewHeightConstraint.active = true + + + self.textLabel.trailingAnchor.constraintEqualToAnchor(self.contentView.trailingAnchor).active = true + self.textLabel.leadingAnchor.constraintEqualToAnchor(self.contentView.leadingAnchor).active = true + + self.textLabelBottomAnchorConstraint = self.textLabel.bottomAnchor.constraintEqualToAnchor(self.contentView.bottomAnchor) + self.textLabelBottomAnchorConstraint.active = true + + self.textLabelVerticalSpacingConstraint = self.textLabel.topAnchor.constraintEqualToAnchor(self.imageView.bottomAnchor) + self.textLabelVerticalSpacingConstraint.active = true + + #if os(tvOS) self.textLabelVerticalSpacingConstraint.active = false - self.textLabelFocusedVerticalSpacingConstraint = self.textLabel.topAnchor.constraintEqualToAnchor(self.imageView.focusedFrameGuide.bottomAnchor, constant: verticalSpacingConstant) + self.textLabelFocusedVerticalSpacingConstraint = self.textLabel.topAnchor.constraintEqualToAnchor(self.imageView.focusedFrameGuide.bottomAnchor, constant: 0) self.textLabelFocusedVerticalSpacingConstraint?.active = true #else self.textLabelVerticalSpacingConstraint.active = true #endif + self.updateMaximumImageSize() } diff --git a/Delta/Pause Menu/Collection View/GridCollectionViewLayout.swift b/Common/Collection View/GridCollectionViewLayout.swift similarity index 100% rename from Delta/Pause Menu/Collection View/GridCollectionViewLayout.swift rename to Common/Collection View/GridCollectionViewLayout.swift diff --git a/Cores/DeltaCore b/Cores/DeltaCore index 3cd685c..08b0e43 160000 --- a/Cores/DeltaCore +++ b/Cores/DeltaCore @@ -1 +1 @@ -Subproject commit 3cd685cb2b1a5756501c240416d70ab2d33df885 +Subproject commit 08b0e43293282cf92ba7a2838dc1b1e2cc7fbdae diff --git a/Cores/SNESDeltaCore b/Cores/SNESDeltaCore index bfab567..ab500a8 160000 --- a/Cores/SNESDeltaCore +++ b/Cores/SNESDeltaCore @@ -1 +1 @@ -Subproject commit bfab5676607a4e8e913b3535c30dd308b25ebaa7 +Subproject commit ab500a88abf285393b5498b0d2cda594a6f2a1e2 diff --git a/Delta.xcodeproj/project.pbxproj b/Delta.xcodeproj/project.pbxproj index 18f9a1f..050b6ba 100644 --- a/Delta.xcodeproj/project.pbxproj +++ b/Delta.xcodeproj/project.pbxproj @@ -24,8 +24,6 @@ BF2A53FE1BB74FC60052BD0C /* ZipZap.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BF70798B1B6B464B0019077C /* ZipZap.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; BF4566E81BC090B6007BFA1A /* Model.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = BF4566E61BC090B6007BFA1A /* Model.xcdatamodeld */; }; BF4566E91BC090B6007BFA1A /* Model.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = BF4566E61BC090B6007BFA1A /* Model.xcdatamodeld */; }; - BF50DC421BD851740024C720 /* GameCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF50DC411BD851740024C720 /* GameCollectionViewCell.swift */; }; - BF50DC431BD851740024C720 /* GameCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF50DC411BD851740024C720 /* GameCollectionViewCell.swift */; }; BF5E7F441B9A650B00AE44F8 /* SettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF5E7F431B9A650B00AE44F8 /* SettingsViewController.swift */; }; BF5E7F461B9A652600AE44F8 /* Settings.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BF5E7F451B9A652600AE44F8 /* Settings.storyboard */; }; BF6BB23F1BB73FE800CCF94A /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF6BB23E1BB73FE800CCF94A /* AppDelegate.swift */; }; @@ -39,22 +37,21 @@ BF762EAB1BC1B076002C8866 /* NSManagedObject+Conveniences.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF762EAA1BC1B076002C8866 /* NSManagedObject+Conveniences.swift */; }; BF762EAC1BC1B076002C8866 /* NSManagedObject+Conveniences.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF762EAA1BC1B076002C8866 /* NSManagedObject+Conveniences.swift */; }; BF797A2D1C2D339F00F1A000 /* UILabel+FontSize.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF797A2C1C2D339F00F1A000 /* UILabel+FontSize.swift */; }; - BF7AE7FE1C2E857A00B1B5BC /* GridCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF7AE7FB1C2E857A00B1B5BC /* GridCollectionViewCell.swift */; }; - BF7AE7FF1C2E857A00B1B5BC /* GridCollectionViewCell.xib in Resources */ = {isa = PBXBuildFile; fileRef = BF7AE7FC1C2E857A00B1B5BC /* GridCollectionViewCell.xib */; }; - BF7AE8001C2E857A00B1B5BC /* GridCollectionViewLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF7AE7FD1C2E857A00B1B5BC /* GridCollectionViewLayout.swift */; }; BF7AE8051C2E858400B1B5BC /* PausePresentationController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF7AE8011C2E858400B1B5BC /* PausePresentationController.swift */; }; BF7AE8061C2E858400B1B5BC /* PausePresentationControllerContentView.xib in Resources */ = {isa = PBXBuildFile; fileRef = BF7AE8021C2E858400B1B5BC /* PausePresentationControllerContentView.xib */; }; BF7AE8071C2E858400B1B5BC /* PauseStoryboardSegue.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF7AE8031C2E858400B1B5BC /* PauseStoryboardSegue.swift */; }; BF7AE8081C2E858400B1B5BC /* PauseViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF7AE8041C2E858400B1B5BC /* PauseViewController.swift */; }; BF7AE80A1C2E8C7600B1B5BC /* UIColor+Delta.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF7AE8091C2E8C7600B1B5BC /* UIColor+Delta.swift */; }; + BF7AE81E1C2E984300B1B5BC /* GridCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF7AE81A1C2E984300B1B5BC /* GridCollectionViewCell.swift */; }; + BF7AE81F1C2E984300B1B5BC /* GridCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF7AE81A1C2E984300B1B5BC /* GridCollectionViewCell.swift */; }; + BF7AE8241C2E984300B1B5BC /* GridCollectionViewLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF7AE81D1C2E984300B1B5BC /* GridCollectionViewLayout.swift */; }; + BF7AE8251C2E984300B1B5BC /* GridCollectionViewLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF7AE81D1C2E984300B1B5BC /* GridCollectionViewLayout.swift */; }; BF8624881BB743FE00C12EEE /* Roxas.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BFEC732C1AAECC4A00650035 /* Roxas.framework */; }; BF8624891BB743FE00C12EEE /* Roxas.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BFEC732C1AAECC4A00650035 /* Roxas.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; BF8624A91BB7464B00C12EEE /* DeltaCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF9F4FCE1AAD7B87004C9500 /* DeltaCore.framework */; }; BF8624AA1BB7464B00C12EEE /* DeltaCore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BF9F4FCE1AAD7B87004C9500 /* DeltaCore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; BF9F4FCF1AAD7B87004C9500 /* DeltaCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF9F4FCE1AAD7B87004C9500 /* DeltaCore.framework */; }; BF9F4FD01AAD7B87004C9500 /* DeltaCore.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BF9F4FCE1AAD7B87004C9500 /* DeltaCore.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; - BFA5342A1BDC6B520088F1BE /* GameCollectionViewLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFA534291BDC6B520088F1BE /* GameCollectionViewLayout.swift */; }; - BFA5342B1BDC6B520088F1BE /* GameCollectionViewLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFA534291BDC6B520088F1BE /* GameCollectionViewLayout.swift */; }; BFAA1FED1B8AA4FA00495943 /* Settings.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFAA1FEC1B8AA4FA00495943 /* Settings.swift */; }; BFAA1FF41B8AD7F900495943 /* ControllersSettingsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFAA1FF31B8AD7F900495943 /* ControllersSettingsViewController.swift */; }; BFB141181BE46934004FBF46 /* GameCollectionViewDataSource.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFB141171BE46934004FBF46 /* GameCollectionViewDataSource.swift */; }; @@ -74,8 +71,6 @@ BFEC732E1AAECC4A00650035 /* Roxas.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = BFEC732C1AAECC4A00650035 /* Roxas.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; BFF1E5641BE04CAF000E9EF6 /* BoxArtImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFF1E5631BE04CAF000E9EF6 /* BoxArtImageView.swift */; }; BFF1E5651BE04CAF000E9EF6 /* BoxArtImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFF1E5631BE04CAF000E9EF6 /* BoxArtImageView.swift */; }; - BFF4EA011BE1B2420056AAA4 /* GameCollectionViewLayoutAttributes.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFF4EA001BE1B2420056AAA4 /* GameCollectionViewLayoutAttributes.swift */; }; - BFF4EA021BE1B2420056AAA4 /* GameCollectionViewLayoutAttributes.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFF4EA001BE1B2420056AAA4 /* GameCollectionViewLayoutAttributes.swift */; }; BFFA71DD1AAC406100EE9DD1 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFFA71DC1AAC406100EE9DD1 /* AppDelegate.swift */; }; BFFA71E21AAC406100EE9DD1 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BFFA71E01AAC406100EE9DD1 /* Main.storyboard */; }; BFFA71E71AAC406100EE9DD1 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = BFFA71E51AAC406100EE9DD1 /* LaunchScreen.xib */; }; @@ -128,7 +123,6 @@ BF27CC941BCB7B7A00A20D89 /* GameController.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = GameController.framework; path = Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.0.sdk/System/Library/Frameworks/GameController.framework; sourceTree = DEVELOPER_DIR; }; BF27CC961BCC890700A20D89 /* GamesCollectionViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GamesCollectionViewController.swift; sourceTree = ""; }; BF4566E71BC090B6007BFA1A /* Model.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Model.xcdatamodel; sourceTree = ""; }; - BF50DC411BD851740024C720 /* GameCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = GameCollectionViewCell.swift; path = "Collection View/GameCollectionViewCell.swift"; sourceTree = ""; }; BF5E7F431B9A650B00AE44F8 /* SettingsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = ""; }; BF5E7F451B9A652600AE44F8 /* Settings.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Settings.storyboard; sourceTree = ""; }; BF6BB23C1BB73FE800CCF94A /* Delta.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Delta.app; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -141,16 +135,14 @@ BF762E9D1BC19D31002C8866 /* DatabaseManager.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DatabaseManager.swift; sourceTree = ""; }; BF762EAA1BC1B076002C8866 /* NSManagedObject+Conveniences.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSManagedObject+Conveniences.swift"; sourceTree = ""; }; BF797A2C1C2D339F00F1A000 /* UILabel+FontSize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UILabel+FontSize.swift"; sourceTree = ""; }; - BF7AE7FB1C2E857A00B1B5BC /* GridCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = GridCollectionViewCell.swift; path = "Delta/Pause Menu/Collection View/GridCollectionViewCell.swift"; sourceTree = SOURCE_ROOT; }; - BF7AE7FC1C2E857A00B1B5BC /* GridCollectionViewCell.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = GridCollectionViewCell.xib; path = "Delta/Pause Menu/Collection View/GridCollectionViewCell.xib"; sourceTree = SOURCE_ROOT; }; - BF7AE7FD1C2E857A00B1B5BC /* GridCollectionViewLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = GridCollectionViewLayout.swift; path = "Delta/Pause Menu/Collection View/GridCollectionViewLayout.swift"; sourceTree = SOURCE_ROOT; }; BF7AE8011C2E858400B1B5BC /* PausePresentationController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PausePresentationController.swift; path = "Pause Menu/PausePresentationController.swift"; sourceTree = ""; }; BF7AE8021C2E858400B1B5BC /* PausePresentationControllerContentView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = PausePresentationControllerContentView.xib; path = "Pause Menu/PausePresentationControllerContentView.xib"; sourceTree = ""; }; BF7AE8031C2E858400B1B5BC /* PauseStoryboardSegue.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PauseStoryboardSegue.swift; path = "Pause Menu/PauseStoryboardSegue.swift"; sourceTree = ""; }; BF7AE8041C2E858400B1B5BC /* PauseViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PauseViewController.swift; path = "Pause Menu/PauseViewController.swift"; sourceTree = ""; }; BF7AE8091C2E8C7600B1B5BC /* UIColor+Delta.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIColor+Delta.swift"; sourceTree = ""; }; + BF7AE81A1C2E984300B1B5BC /* GridCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = GridCollectionViewCell.swift; path = "Collection View/GridCollectionViewCell.swift"; sourceTree = ""; }; + BF7AE81D1C2E984300B1B5BC /* GridCollectionViewLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = GridCollectionViewLayout.swift; path = "Collection View/GridCollectionViewLayout.swift"; sourceTree = ""; }; BF9F4FCE1AAD7B87004C9500 /* DeltaCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = DeltaCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - BFA534291BDC6B520088F1BE /* GameCollectionViewLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = GameCollectionViewLayout.swift; path = "Collection View/GameCollectionViewLayout.swift"; sourceTree = ""; }; BFAA1FEC1B8AA4FA00495943 /* Settings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Settings.swift; sourceTree = ""; }; BFAA1FF31B8AD7F900495943 /* ControllersSettingsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ControllersSettingsViewController.swift; sourceTree = ""; }; BFB141171BE46934004FBF46 /* GameCollectionViewDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = GameCollectionViewDataSource.swift; path = "Collection View/GameCollectionViewDataSource.swift"; sourceTree = ""; }; @@ -162,7 +154,6 @@ BFDE39391BC0CEDF003F72E8 /* Game.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Game.swift; sourceTree = ""; }; BFEC732C1AAECC4A00650035 /* Roxas.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Roxas.framework; sourceTree = BUILT_PRODUCTS_DIR; }; BFF1E5631BE04CAF000E9EF6 /* BoxArtImageView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = BoxArtImageView.swift; path = Components/BoxArtImageView.swift; sourceTree = ""; }; - BFF4EA001BE1B2420056AAA4 /* GameCollectionViewLayoutAttributes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = GameCollectionViewLayoutAttributes.swift; path = "Collection View/GameCollectionViewLayoutAttributes.swift"; sourceTree = ""; }; BFFA71D71AAC406100EE9DD1 /* Delta.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Delta.app; sourceTree = BUILT_PRODUCTS_DIR; }; BFFA71DB1AAC406100EE9DD1 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; BFFA71DC1AAC406100EE9DD1 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -290,7 +281,6 @@ BF7AE8031C2E858400B1B5BC /* PauseStoryboardSegue.swift */, BF7AE8011C2E858400B1B5BC /* PausePresentationController.swift */, BF7AE8021C2E858400B1B5BC /* PausePresentationControllerContentView.xib */, - BF9CB2261C2A025700E7D6C8 /* Collection View */, ); name = "Pause Menu"; sourceTree = ""; @@ -306,25 +296,13 @@ BF9257571BD8244800B109DA /* Collection View */ = { isa = PBXGroup; children = ( - BF50DC411BD851740024C720 /* GameCollectionViewCell.swift */, - BFA534291BDC6B520088F1BE /* GameCollectionViewLayout.swift */, - BFF4EA001BE1B2420056AAA4 /* GameCollectionViewLayoutAttributes.swift */, + BF7AE81A1C2E984300B1B5BC /* GridCollectionViewCell.swift */, + BF7AE81D1C2E984300B1B5BC /* GridCollectionViewLayout.swift */, BFB141171BE46934004FBF46 /* GameCollectionViewDataSource.swift */, ); name = "Collection View"; sourceTree = ""; }; - BF9CB2261C2A025700E7D6C8 /* Collection View */ = { - isa = PBXGroup; - children = ( - BF7AE7FB1C2E857A00B1B5BC /* GridCollectionViewCell.swift */, - BF7AE7FC1C2E857A00B1B5BC /* GridCollectionViewCell.xib */, - BF7AE7FD1C2E857A00B1B5BC /* GridCollectionViewLayout.swift */, - ); - name = "Collection View"; - path = Emulation; - sourceTree = ""; - }; BF9F4FCD1AAD7B25004C9500 /* Frameworks */ = { isa = PBXGroup; children = ( @@ -542,7 +520,6 @@ BF7AE8061C2E858400B1B5BC /* PausePresentationControllerContentView.xib in Resources */, BFFA71E71AAC406100EE9DD1 /* LaunchScreen.xib in Resources */, BF5E7F461B9A652600AE44F8 /* Settings.storyboard in Resources */, - BF7AE7FF1C2E857A00B1B5BC /* GridCollectionViewCell.xib in Resources */, BF27CC8E1BC9FEA200A20D89 /* Assets.xcassets in Resources */, ); runOnlyForDeploymentPostprocessing = 0; @@ -647,10 +624,11 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - BFF4EA021BE1B2420056AAA4 /* GameCollectionViewLayoutAttributes.swift in Sources */, BFC273191BE6152200D22B05 /* GameCollection+CoreDataProperties.swift in Sources */, BF6BB2411BB73FE800CCF94A /* GameSelectionViewController.swift in Sources */, BF27CC8F1BCA010200A20D89 /* GamePickerController.swift in Sources */, + BF7AE81F1C2E984300B1B5BC /* GridCollectionViewCell.swift in Sources */, + BF7AE8251C2E984300B1B5BC /* GridCollectionViewLayout.swift in Sources */, BFDE393D1BC0CEDF003F72E8 /* Game.swift in Sources */, BFC2731B1BE6152200D22B05 /* GameCollection.swift in Sources */, BF762E9F1BC19D31002C8866 /* DatabaseManager.swift in Sources */, @@ -658,8 +636,6 @@ BF27CC911BCB156200A20D89 /* EmulationViewController.swift in Sources */, BFB141191BE46934004FBF46 /* GameCollectionViewDataSource.swift in Sources */, BFF1E5651BE04CAF000E9EF6 /* BoxArtImageView.swift in Sources */, - BF50DC431BD851740024C720 /* GameCollectionViewCell.swift in Sources */, - BFA5342B1BDC6B520088F1BE /* GameCollectionViewLayout.swift in Sources */, BF6BB23F1BB73FE800CCF94A /* AppDelegate.swift in Sources */, BF4566E91BC090B6007BFA1A /* Model.xcdatamodeld in Sources */, BF762EAC1BC1B076002C8866 /* NSManagedObject+Conveniences.swift in Sources */, @@ -670,16 +646,15 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - BFF4EA011BE1B2420056AAA4 /* GameCollectionViewLayoutAttributes.swift in Sources */, BFAA1FED1B8AA4FA00495943 /* Settings.swift in Sources */, - BF50DC421BD851740024C720 /* GameCollectionViewCell.swift in Sources */, + BF7AE8241C2E984300B1B5BC /* GridCollectionViewLayout.swift in Sources */, BFB141181BE46934004FBF46 /* GameCollectionViewDataSource.swift in Sources */, - BF7AE8001C2E857A00B1B5BC /* GridCollectionViewLayout.swift in Sources */, BFFB709F1AF99B1700DE56FE /* EmulationViewController.swift in Sources */, BFAA1FF41B8AD7F900495943 /* ControllersSettingsViewController.swift in Sources */, BF7AE8071C2E858400B1B5BC /* PauseStoryboardSegue.swift in Sources */, BF27CC971BCC890700A20D89 /* GamesCollectionViewController.swift in Sources */, BFFA71DD1AAC406100EE9DD1 /* AppDelegate.swift in Sources */, + BF7AE81E1C2E984300B1B5BC /* GridCollectionViewCell.swift in Sources */, BF4566E81BC090B6007BFA1A /* Model.xcdatamodeld in Sources */, BFDE393C1BC0CEDF003F72E8 /* Game.swift in Sources */, BFC273181BE6152200D22B05 /* GameCollection+CoreDataProperties.swift in Sources */, @@ -687,7 +662,6 @@ BFF1E5641BE04CAF000E9EF6 /* BoxArtImageView.swift in Sources */, BF762EAB1BC1B076002C8866 /* NSManagedObject+Conveniences.swift in Sources */, BF7AE80A1C2E8C7600B1B5BC /* UIColor+Delta.swift in Sources */, - BFA5342A1BDC6B520088F1BE /* GameCollectionViewLayout.swift in Sources */, BF762E9E1BC19D31002C8866 /* DatabaseManager.swift in Sources */, BF090CF41B490D8300DCAB45 /* UIDevice+Vibration.m in Sources */, BF797A2D1C2D339F00F1A000 /* UILabel+FontSize.swift in Sources */, @@ -695,7 +669,6 @@ BF5E7F441B9A650B00AE44F8 /* SettingsViewController.swift in Sources */, BFDB28451BC9DA7B001D0C83 /* GamePickerController.swift in Sources */, BF7AE8051C2E858400B1B5BC /* PausePresentationController.swift in Sources */, - BF7AE7FE1C2E857A00B1B5BC /* GridCollectionViewCell.swift in Sources */, BFDE393A1BC0CEDF003F72E8 /* Game+CoreDataProperties.swift in Sources */, BF7AE8081C2E858400B1B5BC /* PauseViewController.swift in Sources */, ); diff --git a/Delta/Base.lproj/Main.storyboard b/Delta/Base.lproj/Main.storyboard index 7c3fd31..20f4411 100644 --- a/Delta/Base.lproj/Main.storyboard +++ b/Delta/Base.lproj/Main.storyboard @@ -58,15 +58,15 @@ - + - + - - + + @@ -331,6 +331,6 @@ - + diff --git a/Delta/Game Selection/GamesCollectionViewController.swift b/Delta/Game Selection/GamesCollectionViewController.swift index 5a37656..6a47bbf 100644 --- a/Delta/Game Selection/GamesCollectionViewController.swift +++ b/Delta/Game Selection/GamesCollectionViewController.swift @@ -40,9 +40,9 @@ class GamesCollectionViewController: UICollectionViewController self.collectionView?.dataSource = self.dataSource self.collectionView?.delegate = self.dataSource - if let layout = self.collectionViewLayout as? GameCollectionViewLayout + if let layout = self.collectionViewLayout as? GridCollectionViewLayout { - layout.maximumBoxArtSize = CGSize(width: 100, height: 100) + layout.itemWidth = 90 } } @@ -69,9 +69,11 @@ class GamesCollectionViewController: UICollectionViewController // MARK: - Collection View - - private func configureCell(cell: GameCollectionViewCell, game: Game) + private func configureCell(cell: GridCollectionViewCell, game: Game) { - cell.nameLabel.text = game.name + cell.maximumImageSize = CGSize(width: 90, height: 90) + cell.textLabel.text = game.name + cell.imageView.image = UIImage(named: "BoxArt") } } diff --git a/Delta/Pause Menu/Collection View/GridCollectionViewCell.xib b/Delta/Pause Menu/Collection View/GridCollectionViewCell.xib deleted file mode 100644 index b610cf8..0000000 --- a/Delta/Pause Menu/Collection View/GridCollectionViewCell.xib +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Delta/Pause Menu/PauseViewController.swift b/Delta/Pause Menu/PauseViewController.swift index e143890..5ab414f 100644 --- a/Delta/Pause Menu/PauseViewController.swift +++ b/Delta/Pause Menu/PauseViewController.swift @@ -41,10 +41,7 @@ class PauseViewController: UIViewController, PauseInfoProvidable return self.collectionView.collectionViewLayout as! GridCollectionViewLayout } - private var prototypeCell: GridCollectionViewCell = { - let nib = UINib(nibName: "GridCollectionViewCell", bundle: nil) - return nib.instantiateWithOwner(nil, options: nil).first as! GridCollectionViewCell - }() + private var prototypeCell = GridCollectionViewCell() override func preferredStatusBarStyle() -> UIStatusBarStyle { @@ -55,8 +52,7 @@ class PauseViewController: UIViewController, PauseInfoProvidable { super.viewDidLoad() - let nib = UINib(nibName: "GridCollectionViewCell", bundle: nil) - self.collectionView.registerNib(nib, forCellWithReuseIdentifier: "Cell") + self.collectionView.registerClass(GridCollectionViewCell.self, forCellWithReuseIdentifier: "Cell") self.collectionViewLayout.itemWidth = 90 self.collectionViewLayout.usesEqualHorizontalSpacingDistributionForSingleRow = true diff --git a/DeltaTV/Base.lproj/Main.storyboard b/DeltaTV/Base.lproj/Main.storyboard index f734464..5186074 100644 --- a/DeltaTV/Base.lproj/Main.storyboard +++ b/DeltaTV/Base.lproj/Main.storyboard @@ -1,7 +1,7 @@ - + - + @@ -11,24 +11,21 @@ - - + - + - - @@ -66,11 +63,9 @@ - - @@ -94,7 +89,6 @@ - diff --git a/DeltaTV/GameSelectionViewController.swift b/DeltaTV/GameSelectionViewController.swift index f75b71f..182c4c9 100644 --- a/DeltaTV/GameSelectionViewController.swift +++ b/DeltaTV/GameSelectionViewController.swift @@ -36,9 +36,9 @@ class GameSelectionViewController: UICollectionViewController self.collectionView?.dataSource = self.dataSource self.collectionView?.delegate = self.dataSource - if let layout = self.collectionViewLayout as? GameCollectionViewLayout + if let layout = self.collectionViewLayout as? GridCollectionViewLayout { - layout.maximumBoxArtSize = CGSize(width: 200, height: 200) + layout.itemWidth = 200 } self.backgroundView = RSTBackgroundView(frame: self.view.bounds) @@ -86,10 +86,14 @@ class GameSelectionViewController: UICollectionViewController // MARK: - Collection View - - private func configureCell(cell: GameCollectionViewCell, game: Game) + private func configureCell(cell: GridCollectionViewCell, game: Game) { - cell.nameLabel.font = UIFont.boldSystemFontOfSize(30) - cell.nameLabel.text = game.name + cell.maximumImageSize = CGSize(width: 200, height: 200) + + cell.textLabel.font = UIFont.boldSystemFontOfSize(30) + cell.textLabel.text = game.name + + cell.imageView.image = UIImage(named: "BoxArt") } }