-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for “Remainder” BrickDimension
A Remainder BrickDimension will have a width that is the remainder that is left on a row Fixes #39
- Loading branch information
1 parent
dfe0610
commit 1d49898
Showing
12 changed files
with
251 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
Example/Source/Examples/Simple/RemainderBrickViewController.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// RemainderBrickViewController.swift | ||
// BrickKit-Example | ||
// | ||
// Created by Ruben Cagnie on 12/4/16. | ||
// Copyright © 2016 Wayfair LLC. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
import BrickKit | ||
|
||
class RemainderBrickViewController: BrickViewController { | ||
override class var title: String { | ||
return "Remainder Example" | ||
} | ||
|
||
override class var subTitle: String { | ||
return "Example of using the Remainder BrickDimension" | ||
} | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
self.registerBrickClass(LabelBrick.self) | ||
|
||
self.view.backgroundColor = .brickBackground | ||
|
||
let configureCell: (cell: LabelBrickCell) -> Void = { cell in | ||
cell.configure() | ||
} | ||
|
||
let section = BrickSection(bricks: [ | ||
LabelBrick(width: .Fixed(size: 50), backgroundColor: .brickGray1, text: "BRICK", configureCellBlock: configureCell), | ||
LabelBrick(width: .Remainder, backgroundColor: .brickGray3, text: "BRICK", configureCellBlock: configureCell), | ||
LabelBrick(width: .Remainder, backgroundColor: .brickGray5, text: "BRICK", configureCellBlock: configureCell), | ||
LabelBrick(width: .Fixed(size: 50), backgroundColor: .brickGray2, text: "BRICK", configureCellBlock: configureCell), | ||
BrickSection(width: .Remainder, backgroundColor: .brickGray4, bricks: [ | ||
LabelBrick(width: .Ratio(ratio: 0.25), backgroundColor: .brickGray1, text: "BRICK", configureCellBlock: configureCell), | ||
LabelBrick(width: .Remainder, backgroundColor: .brickGray3, text: "BRICK", configureCellBlock: configureCell), | ||
]) | ||
], inset: 10, edgeInsets: UIEdgeInsets(top: 20, left: 10, bottom: 20, right: 10)) | ||
|
||
self.setSection(section) | ||
} | ||
|
||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.