Finish 01-Storm-Viewer Project

This commit is contained in:
CypherPoet 2019-01-13 17:06:02 -05:00
parent 419ec06cc9
commit 0f1bd67cfc
4 changed files with 35 additions and 12 deletions

View File

@ -6,7 +6,6 @@
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14460.20"/>
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
</dependencies>
<scenes>
@ -19,15 +18,15 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" indentationWidth="10" reuseIdentifier="Picture" textLabel="qem-fj-5MQ" style="IBUITableViewCellStyleDefault" id="cr7-Lh-RQP">
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" preservesSuperviewLayoutMargins="YES" selectionStyle="default" accessoryType="disclosureIndicator" indentationWidth="10" reuseIdentifier="Picture" textLabel="qem-fj-5MQ" style="IBUITableViewCellStyleDefault" id="cr7-Lh-RQP">
<rect key="frame" x="0.0" y="28" width="375" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" preservesSuperviewLayoutMargins="YES" insetsLayoutMarginsFromSafeArea="NO" tableViewCell="cr7-Lh-RQP" id="iCp-08-NKl">
<rect key="frame" x="0.0" y="0.0" width="375" height="43.5"/>
<rect key="frame" x="0.0" y="0.0" width="341" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<label opaque="NO" multipleTouchEnabled="YES" contentMode="left" insetsLayoutMarginsFromSafeArea="NO" text="Title" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" id="qem-fj-5MQ">
<rect key="frame" x="16" y="0.0" width="343" height="43.5"/>
<rect key="frame" x="16" y="0.0" width="324" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
@ -74,7 +73,7 @@
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<imageView userInteractionEnabled="NO" contentMode="scaleToFill" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="XEW-Lo-AqF">
<imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" translatesAutoresizingMaskIntoConstraints="NO" id="XEW-Lo-AqF">
<rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
</imageView>
</subviews>
@ -82,10 +81,9 @@
<constraints>
<constraint firstItem="XEW-Lo-AqF" firstAttribute="leading" secondItem="GBY-9N-YdR" secondAttribute="leading" id="Rrr-Ib-fgB"/>
<constraint firstItem="XEW-Lo-AqF" firstAttribute="top" secondItem="GBY-9N-YdR" secondAttribute="top" id="fhq-mS-UKb"/>
<constraint firstItem="XEW-Lo-AqF" firstAttribute="bottom" secondItem="XzG-2q-tKh" secondAttribute="bottom" id="rFn-Ho-Mml"/>
<constraint firstItem="XEW-Lo-AqF" firstAttribute="bottom" secondItem="GBY-9N-YdR" secondAttribute="bottom" id="rFn-Ho-Mml"/>
<constraint firstAttribute="trailing" secondItem="XEW-Lo-AqF" secondAttribute="trailing" id="tAb-Tf-8eg"/>
</constraints>
<viewLayoutGuide key="safeArea" id="XzG-2q-tKh"/>
</view>
<connections>
<outlet property="imageView" destination="XEW-Lo-AqF" id="XzE-xQ-8al"/>

View File

@ -13,14 +13,35 @@ class DetailViewController: UIViewController {
var imagePath: String?
override var prefersHomeIndicatorAutoHidden: Bool {
get {
return navigationController?.hidesBarsOnTap ?? false
}
}
override func viewDidLoad() {
super.viewDidLoad()
title = imagePath
navigationItem.largeTitleDisplayMode = .never
if let _imagePath = imagePath {
imageView.image = UIImage(named: _imagePath)
}
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.hidesBarsOnTap = true
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
navigationController?.hidesBarsOnTap = false
}
/*
// MARK: - Navigation

View File

@ -10,10 +10,12 @@ import UIKit
class ViewController: UITableViewController {
var imagePaths = [String]()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
title = "Storm Viewer ⚡️"
navigationController?.navigationBar.prefersLargeTitles = true
let fm = FileManager.default
let path = Bundle.main.resourcePath!
@ -25,10 +27,12 @@ class ViewController: UITableViewController {
print(imagePaths)
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
return imagePaths.count
}
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Picture", for: indexPath)
@ -45,7 +49,7 @@ class ViewController: UITableViewController {
// set the vc's `imagePath` property to match the image selected
detailViewController.imagePath = imagePaths[indexPath.row]
// push the detail vc onto the naviation controller
// push the detail VC onto the navigation controller
navigationController?.pushViewController(detailViewController, animated: true)
}
}

View File

@ -7,10 +7,10 @@
### Beginner 📕
| # | Project | Topics Learned | Progress |
| # | Project | Topics Covered | Progress |
| :--: | :--------------------------: | :--------------: | :--------: |
| 0 | 🛠<br>[Introduction to Swift](/00-Introduction-to-Swift) | Playgrounds, Constants & Variables, Data Types, Operators, String Interpolation, Arrays & Dictionaries, Conditional Statements, Control Flow, Functions & Methods, Optionals, Enumerations, Classes & Structures, Property Observers, Access Control, Typecasting, Closures | ✅ |
| 1 | 📱<br>[Storm Viewer](/01-Storm-Viewer) | Xcode, UIKit, UIViewController, `super`, viewDidLoad(), FileManager, Bundle, `try-catch` Blocks, print(), Storyboards & Interface Builder, UITableView, UITableViewDelegate, UITableViewDataSource, UIImageView, UIImage, UIButton, Auto Layout, Outlets & Actions, UINavigationController | 🔴 |
| 0 | 🛠<br>[Introduction to Swift](/00-Introduction-to-Swift) | playgrounds, constants & variables, data types, operators, string interpolation, arrays & dictionaries, conditional statements, control flow, functions & methods, optionals, enumerations, classes & structures, property observers, access control, typecasting, closures | ✅ |
| 1 | 📱<br>[Storm Viewer](/01-Storm-Viewer) | Xcode, UIKit, UIViewController, `super`, viewDidLoad(), FileManager, app bundles, `try-catch` blocks, Storyboards & Interface Builder, UITableView, UITableViewDelegate, UITableViewDataSource, UIImageView, UIImage, UIButton, Auto Layout, Outlets & Actions, UINavigationController, view stacking | ✅ |
| 2 | 🕹<br>[Guess the Flag](/02-Guess-the-Flag) | UIButton, Asset Catalogs, Retina displays & @2x and @3x images, UIControlState, CALayer, UIView, UIColor, CGColor, Random Numbers, UIAlertController, UIAlertAction, UILabel | 🔴 |
| 3 | 🛠 [Social Media](/03-Social-Media) | UIActivityViewController, UINavigationBar, UIBarButtonItem, `#selector` & `@objc`, Info.plist, Privacy & Permissions | 🔴 |
| 4 | 📱<br>[Easy Browser](/04-Easy-Browser) | WKWebView, URL, URLRequest, UIToolbar, UIProgressView, KVO Design Pattern, WKNavigationDelegate | 🔴 |