-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDetailViewController.swift
45 lines (34 loc) · 1.17 KB
/
DetailViewController.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//
// DetailViewController.swift
// CameraCaptions
//
// Created by Julian Moorhouse on 07/08/2019.
// Copyright © 2019 Mindwarp Consultancy Ltd. All rights reserved.
//
import UIKit
class DetailViewController: UIViewController {
@IBOutlet var imageView: UIImageView!
var selectedImage: String?
var caption: String?
override func viewDidLoad() {
super.viewDidLoad()
title = caption
navigationItem.largeTitleDisplayMode = .never
if let imageToLoad = selectedImage {
let path = getDocumentsDirectory().appendingPathComponent(imageToLoad)
imageView.image = UIImage(contentsOfFile: path.path)
}
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
navigationController?.hidesBarsOnTap = true
}
override func viewWillDisappear(_ animated: Bool) {
super.viewWillDisappear(animated)
navigationController?.hidesBarsOnTap = false
}
func getDocumentsDirectory() -> URL {
let paths = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)
return paths[0]
}
}