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)
This commit is contained in:
Riley Testut 2015-12-26 04:09:45 -06:00
parent b25ee75d67
commit 46eb747737
15 changed files with 100 additions and 423 deletions

View File

@ -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)
}
}

View File

@ -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
}
}

View File

@ -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
}
}

View File

@ -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
}
}

View File

@ -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()
}

@ -1 +1 @@
Subproject commit 3cd685cb2b1a5756501c240416d70ab2d33df885
Subproject commit 08b0e43293282cf92ba7a2838dc1b1e2cc7fbdae

@ -1 +1 @@
Subproject commit bfab5676607a4e8e913b3535c30dd308b25ebaa7
Subproject commit ab500a88abf285393b5498b0d2cda594a6f2a1e2

View File

@ -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 = "<group>"; };
BF4566E71BC090B6007BFA1A /* Model.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Model.xcdatamodel; sourceTree = "<group>"; };
BF50DC411BD851740024C720 /* GameCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = GameCollectionViewCell.swift; path = "Collection View/GameCollectionViewCell.swift"; sourceTree = "<group>"; };
BF5E7F431B9A650B00AE44F8 /* SettingsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsViewController.swift; sourceTree = "<group>"; };
BF5E7F451B9A652600AE44F8 /* Settings.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Settings.storyboard; sourceTree = "<group>"; };
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 = "<group>"; };
BF762EAA1BC1B076002C8866 /* NSManagedObject+Conveniences.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "NSManagedObject+Conveniences.swift"; sourceTree = "<group>"; };
BF797A2C1C2D339F00F1A000 /* UILabel+FontSize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UILabel+FontSize.swift"; sourceTree = "<group>"; };
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 = "<group>"; };
BF7AE8021C2E858400B1B5BC /* PausePresentationControllerContentView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; name = PausePresentationControllerContentView.xib; path = "Pause Menu/PausePresentationControllerContentView.xib"; sourceTree = "<group>"; };
BF7AE8031C2E858400B1B5BC /* PauseStoryboardSegue.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PauseStoryboardSegue.swift; path = "Pause Menu/PauseStoryboardSegue.swift"; sourceTree = "<group>"; };
BF7AE8041C2E858400B1B5BC /* PauseViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = PauseViewController.swift; path = "Pause Menu/PauseViewController.swift"; sourceTree = "<group>"; };
BF7AE8091C2E8C7600B1B5BC /* UIColor+Delta.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIColor+Delta.swift"; sourceTree = "<group>"; };
BF7AE81A1C2E984300B1B5BC /* GridCollectionViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = GridCollectionViewCell.swift; path = "Collection View/GridCollectionViewCell.swift"; sourceTree = "<group>"; };
BF7AE81D1C2E984300B1B5BC /* GridCollectionViewLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = GridCollectionViewLayout.swift; path = "Collection View/GridCollectionViewLayout.swift"; sourceTree = "<group>"; };
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 = "<group>"; };
BFAA1FEC1B8AA4FA00495943 /* Settings.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Settings.swift; sourceTree = "<group>"; };
BFAA1FF31B8AD7F900495943 /* ControllersSettingsViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ControllersSettingsViewController.swift; sourceTree = "<group>"; };
BFB141171BE46934004FBF46 /* GameCollectionViewDataSource.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = GameCollectionViewDataSource.swift; path = "Collection View/GameCollectionViewDataSource.swift"; sourceTree = "<group>"; };
@ -162,7 +154,6 @@
BFDE39391BC0CEDF003F72E8 /* Game.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Game.swift; sourceTree = "<group>"; };
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 = "<group>"; };
BFF4EA001BE1B2420056AAA4 /* GameCollectionViewLayoutAttributes.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = GameCollectionViewLayoutAttributes.swift; path = "Collection View/GameCollectionViewLayoutAttributes.swift"; sourceTree = "<group>"; };
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 = "<group>"; };
BFFA71DC1AAC406100EE9DD1 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
@ -290,7 +281,6 @@
BF7AE8031C2E858400B1B5BC /* PauseStoryboardSegue.swift */,
BF7AE8011C2E858400B1B5BC /* PausePresentationController.swift */,
BF7AE8021C2E858400B1B5BC /* PausePresentationControllerContentView.xib */,
BF9CB2261C2A025700E7D6C8 /* Collection View */,
);
name = "Pause Menu";
sourceTree = "<group>";
@ -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 = "<group>";
};
BF9CB2261C2A025700E7D6C8 /* Collection View */ = {
isa = PBXGroup;
children = (
BF7AE7FB1C2E857A00B1B5BC /* GridCollectionViewCell.swift */,
BF7AE7FC1C2E857A00B1B5BC /* GridCollectionViewCell.xib */,
BF7AE7FD1C2E857A00B1B5BC /* GridCollectionViewLayout.swift */,
);
name = "Collection View";
path = Emulation;
sourceTree = "<group>";
};
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 */,
);

View File

@ -58,15 +58,15 @@
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="10" minimumInteritemSpacing="10" id="NKN-dd-bTh" customClass="GameCollectionViewLayout" customModule="Delta" customModuleProvider="target">
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="20" minimumInteritemSpacing="10" id="NKN-dd-bTh" customClass="GridCollectionViewLayout" customModule="Delta" customModuleProvider="target">
<size key="itemSize" width="100" height="100"/>
<size key="headerReferenceSize" width="0.0" height="0.0"/>
<size key="footerReferenceSize" width="0.0" height="0.0"/>
<inset key="sectionInset" minX="10" minY="10" maxX="10" maxY="10"/>
<inset key="sectionInset" minX="0.0" minY="20" maxX="0.0" maxY="20"/>
</collectionViewFlowLayout>
<cells>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="GameCell" id="ioT-sh-j8y" customClass="GameCollectionViewCell" customModule="Delta" customModuleProvider="target">
<rect key="frame" x="10" y="10" width="100" height="100"/>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="GameCell" id="ioT-sh-j8y" customClass="GridCollectionViewCell" customModule="Delta" customModuleProvider="target">
<rect key="frame" x="0.0" y="20" width="100" height="100"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="100" height="100"/>
@ -331,6 +331,6 @@
<image name="Settings_Button" width="22" height="22"/>
</resources>
<inferredMetricsTieBreakers>
<segue reference="Ila-yL-N8w"/>
<segue reference="Jd4-q3-dNr"/>
</inferredMetricsTieBreakers>
</document>

View File

@ -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")
}
}

View File

@ -1,51 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
</dependencies>
<objects>
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner"/>
<placeholder placeholderIdentifier="IBFirstResponder" id="-2" customClass="UIResponder"/>
<collectionViewCell opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" id="n6R-hD-aNv" customClass="GridCollectionViewCell" customModule="Delta" customModuleProvider="target">
<rect key="frame" x="0.0" y="0.0" width="150" height="115"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="150" height="115"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="lky-CJ-5CM">
<rect key="frame" x="25" y="0.0" width="100" height="100"/>
<constraints>
<constraint firstAttribute="height" constant="100" id="PiQ-26-wMh"/>
<constraint firstAttribute="width" constant="100" id="xR5-SN-due"/>
</constraints>
</imageView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Test Label" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="M6I-0c-ddJ">
<rect key="frame" x="0.0" y="100" width="150" height="15"/>
<fontDescription key="fontDescription" type="boldSystem" pointSize="12"/>
<nil key="highlightedColor"/>
</label>
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
<constraints>
<constraint firstAttribute="trailing" secondItem="M6I-0c-ddJ" secondAttribute="trailing" id="1QY-4w-9Ye"/>
<constraint firstItem="M6I-0c-ddJ" firstAttribute="leading" secondItem="n6R-hD-aNv" secondAttribute="leading" id="3wf-gY-fwo"/>
<constraint firstAttribute="bottom" secondItem="M6I-0c-ddJ" secondAttribute="bottom" id="DKB-Hm-thj"/>
<constraint firstAttribute="trailing" secondItem="M6I-0c-ddJ" secondAttribute="trailing" id="K2f-LJ-dAT"/>
<constraint firstItem="lky-CJ-5CM" firstAttribute="top" secondItem="n6R-hD-aNv" secondAttribute="top" id="MaM-Sw-igX"/>
<constraint firstItem="M6I-0c-ddJ" firstAttribute="leading" secondItem="n6R-hD-aNv" secondAttribute="leading" id="O91-X2-BeC"/>
<constraint firstItem="lky-CJ-5CM" firstAttribute="centerX" secondItem="n6R-hD-aNv" secondAttribute="centerX" id="VLv-hn-k8b"/>
<constraint firstItem="M6I-0c-ddJ" firstAttribute="top" secondItem="lky-CJ-5CM" secondAttribute="bottom" id="mdf-No-2YV"/>
</constraints>
<connections>
<outlet property="imageView" destination="lky-CJ-5CM" id="ITm-Jd-Mjd"/>
<outlet property="imageViewHeightConstraint" destination="PiQ-26-wMh" id="Oeb-Pb-Vfs"/>
<outlet property="imageViewWidthConstraint" destination="xR5-SN-due" id="Igw-6S-zjZ"/>
<outlet property="textLabel" destination="M6I-0c-ddJ" id="JqT-rT-YCa"/>
<outlet property="textLabelBottomAnchorConstraint" destination="DKB-Hm-thj" id="zr7-PW-0op"/>
<outlet property="textLabelVerticalSpacingConstraint" destination="mdf-No-2YV" id="46C-fS-uDm"/>
</connections>
</collectionViewCell>
</objects>
</document>

View File

@ -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

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder.AppleTV.Storyboard" version="3.0" toolsVersion="9059" systemVersion="15A284" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" initialViewController="FTg-JN-aQ6">
<document type="com.apple.InterfaceBuilder.AppleTV.Storyboard" version="3.0" toolsVersion="9531" systemVersion="15C50" targetRuntime="AppleTV" propertyAccessControl="none" useAutolayout="YES" initialViewController="FTg-JN-aQ6">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9049"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9529"/>
</dependencies>
<scenes>
<!--Game Selection View Controller-->
@ -11,24 +11,21 @@
<collectionView key="view" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" dataMode="prototypes" id="FJM-CE-KMj">
<rect key="frame" x="0.0" y="0.0" width="1920" height="1080"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="50" minimumInteritemSpacing="50" id="Ixm-Mb-fwd" customClass="GameCollectionViewLayout" customModule="Delta" customModuleProvider="target">
<collectionViewFlowLayout key="collectionViewLayout" minimumLineSpacing="50" minimumInteritemSpacing="50" id="Ixm-Mb-fwd" customClass="GridCollectionViewLayout" customModule="Delta" customModuleProvider="target">
<size key="itemSize" width="130" height="130"/>
<size key="headerReferenceSize" width="0.0" height="0.0"/>
<size key="footerReferenceSize" width="0.0" height="0.0"/>
<inset key="sectionInset" minX="120" minY="0.0" maxX="120" maxY="0.0"/>
</collectionViewFlowLayout>
<cells>
<collectionViewCell opaque="NO" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="GameCell" id="6sa-FK-4f7" customClass="GameCollectionViewCell" customModule="Delta" customModuleProvider="target">
<collectionViewCell opaque="NO" multipleTouchEnabled="YES" contentMode="center" reuseIdentifier="GameCell" id="6sa-FK-4f7" customClass="GridCollectionViewCell" customModule="Delta" customModuleProvider="target">
<rect key="frame" x="120" y="145" width="130" height="130"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center">
<rect key="frame" x="0.0" y="0.0" width="130" height="130"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
</view>
<animations/>
<connections>
<segue destination="MrZ-ya-63l" kind="presentation" identifier="emulationViewControllerSegue" id="ksw-k4-XHA"/>
</connections>
@ -66,11 +63,9 @@
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="LCh-ID-K2p" customClass="GameView" customModule="DeltaCore">
<rect key="frame" x="0.0" y="0.0" width="1920" height="1080"/>
<animations/>
<color key="backgroundColor" white="0.0" alpha="1" colorSpace="calibratedWhite"/>
</view>
</subviews>
<animations/>
<constraints>
<constraint firstItem="LCh-ID-K2p" firstAttribute="top" secondItem="MM0-dd-mwD" secondAttribute="bottom" id="4qb-eG-1PD"/>
<constraint firstAttribute="trailing" secondItem="LCh-ID-K2p" secondAttribute="trailing" id="HCF-lu-VDh"/>
@ -94,7 +89,6 @@
<navigationBar key="navigationBar" contentMode="scaleToFill" id="hum-xC-crg">
<rect key="frame" x="0.0" y="0.0" width="1920" height="145"/>
<autoresizingMask key="autoresizingMask"/>
<animations/>
</navigationBar>
<nil name="viewControllers"/>
<connections>

View File

@ -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")
}
}