-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add LearnAboutSizeClasses sample app
- Loading branch information
Eric Hyche
committed
Aug 11, 2017
1 parent
3505df9
commit 3654c32
Showing
18 changed files
with
858 additions
and
6 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
Binary file modified
BIN
+3.62 KB
(120%)
...codeproj/project.xcworkspace/xcuserdata/ehyche.xcuserdatad/UserInterfaceState.xcuserstate
Binary file not shown.
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
47 changes: 47 additions & 0 deletions
47
DebuggingAutoLayout/DebuggingAutoLayout/EHAmbiguousViewController.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 @@ | ||
// | ||
// EHAmbiguousViewController.swift | ||
// DebuggingAutoLayout | ||
// | ||
// Created by Eric Hyche on 8/9/17. | ||
// Copyright © 2017 HeirPlay Software. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
class EHAmbiguousViewController: UIViewController { | ||
|
||
private let adjustable = EHAdjustableContainerView(frame: .zero) | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
navigationItem.title = "Ambiguous Layouts" | ||
|
||
view.backgroundColor = UIColor.white | ||
|
||
adjustable.translatesAutoresizingMaskIntoConstraints = false | ||
view.addSubview(adjustable) | ||
|
||
adjustable.leadingAnchor.constraint(equalTo: view.layoutMarginsGuide.leadingAnchor).isActive = true | ||
adjustable.trailingAnchor.constraint(equalTo: view.layoutMarginsGuide.trailingAnchor).isActive = true | ||
adjustable.topAnchor.constraint(equalTo: topLayoutGuide.bottomAnchor).isActive = true | ||
adjustable.bottomAnchor.constraint(equalTo: bottomLayoutGuide.topAnchor).isActive = true | ||
|
||
let label0 = UILabel(frame: .zero) | ||
label0.translatesAutoresizingMaskIntoConstraints = false | ||
label0.backgroundColor = UIColor.purple | ||
label0.textColor = UIColor.white | ||
label0.font = UIFont.boldSystemFont(ofSize: 18.0) | ||
label0.text = "This is a label" | ||
adjustable.containerView.addSubview(label0) | ||
|
||
// We intentionally "forget" to position | ||
// label0.centerYAnchor.constraint(equalTo: adjustable.containerView.centerYAnchor).isActive = true | ||
label0.widthAnchor.constraint(greaterThanOrEqualToConstant: 100.0).isActive = true | ||
label0.leadingAnchor.constraint(equalTo: adjustable.containerView.layoutMarginsGuide.leadingAnchor).isActive = true | ||
label0.trailingAnchor.constraint(equalTo: adjustable.containerView.layoutMarginsGuide.trailingAnchor).isActive = true | ||
|
||
} | ||
|
||
|
||
} |
45 changes: 45 additions & 0 deletions
45
DebuggingAutoLayout/DebuggingAutoLayout/EHAutosizingMaskErrorViewController.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,45 @@ | ||
// | ||
// EHAutosizingMaskErrorViewController.swift | ||
// DebuggingAutoLayout | ||
// | ||
// Created by Eric Hyche on 8/9/17. | ||
// Copyright © 2017 HeirPlay Software. All rights reserved. | ||
// | ||
|
||
import UIKit | ||
|
||
class EHAutosizingMaskErrorViewController: UIViewController { | ||
|
||
private let adjustable = EHAdjustableContainerView(frame: .zero) | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
navigationItem.title = "Unsatisfiable Layouts" | ||
|
||
view.backgroundColor = UIColor.white | ||
|
||
adjustable.translatesAutoresizingMaskIntoConstraints = false | ||
view.addSubview(adjustable) | ||
|
||
adjustable.leadingAnchor.constraint(equalTo: view.layoutMarginsGuide.leadingAnchor).isActive = true | ||
adjustable.trailingAnchor.constraint(equalTo: view.layoutMarginsGuide.trailingAnchor).isActive = true | ||
adjustable.topAnchor.constraint(equalTo: topLayoutGuide.bottomAnchor).isActive = true | ||
adjustable.bottomAnchor.constraint(equalTo: bottomLayoutGuide.topAnchor).isActive = true | ||
|
||
let label0 = UILabel(frame: .zero) | ||
// label0.translatesAutoresizingMaskIntoConstraints = false | ||
label0.backgroundColor = UIColor.purple | ||
label0.textColor = UIColor.white | ||
label0.font = UIFont.boldSystemFont(ofSize: 18.0) | ||
label0.text = "This is a label" | ||
adjustable.containerView.addSubview(label0) | ||
|
||
label0.centerYAnchor.constraint(equalTo: adjustable.containerView.centerYAnchor).isActive = true | ||
label0.widthAnchor.constraint(greaterThanOrEqualToConstant: 100.0).isActive = true | ||
label0.leadingAnchor.constraint(equalTo: adjustable.containerView.layoutMarginsGuide.leadingAnchor).isActive = true | ||
label0.trailingAnchor.constraint(equalTo: adjustable.containerView.layoutMarginsGuide.trailingAnchor).isActive = true | ||
} | ||
|
||
|
||
} |
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.