forked from asuc-octo/berkeley-mobile-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathResourceNavigationController.swift
More file actions
49 lines (37 loc) · 1.36 KB
/
ResourceNavigationController.swift
File metadata and controls
49 lines (37 loc) · 1.36 KB
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
46
47
48
49
import UIKit
/**
* Base navigation controller for a single type of `Resource`.
*/
class ResourceNavigationController: UINavigationController, IBInitializable
{
// ========================================
// MARK: - IBInitializable
// ========================================
typealias IBComponent = ResourceNavigationController
static var componentID: String { return className(IBComponent.self) }
static func fromIB() -> IBComponent
{
return UIStoryboard.resource.instantiateViewController(withIdentifier: self.componentID) as! IBComponent
}
// ========================================
// MARK: - UINavigationController
// ========================================
override func awakeFromNib()
{
self.pageTabBarItem.imageView?.contentMode = .scaleAspectFit
}
override func viewWillAppear(_ animated: Bool)
{
super.viewWillAppear(animated)
self.pageTabBarController?.highlightTabItem(of: self)
}
// ========================================
// MARK: - RequiresData
// ========================================
func setGroup(_ group: ResourceGroup)
{
pageTabBarItem.image = group.icon
let groupVC = viewControllers.first as? ResourceGroupViewController
groupVC?.setGroup(group)
}
}