Skip to content

Commit 15a7a8c

Browse files
committed
Chapter 10
Chapter 10
1 parent 9b9fc4c commit 15a7a8c

File tree

19 files changed

+1432
-0
lines changed

19 files changed

+1432
-0
lines changed

UINavigationController10/UINavigationController10.xcodeproj/project.pbxproj

+440
Large diffs are not rendered by default.

UINavigationController10/UINavigationController10.xcodeproj/project.xcworkspace/contents.xcworkspacedata

+7
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Bucket
3+
type = "1"
4+
version = "2.0">
5+
<Breakpoints>
6+
<BreakpointProxy
7+
BreakpointExtensionID = "Xcode.Breakpoint.FileBreakpoint">
8+
<BreakpointContent
9+
shouldBeEnabled = "No"
10+
ignoreCount = "0"
11+
continueAfterRunningActions = "No"
12+
filePath = "UINavigationController10/BNRItemTableViewController.swift"
13+
timestampString = "442034270.043974"
14+
startingColumnNumber = "9223372036854775807"
15+
endingColumnNumber = "9223372036854775807"
16+
startingLineNumber = "76"
17+
endingLineNumber = "76"
18+
landmarkName = "init(nibName:bundle:)"
19+
landmarkType = "5">
20+
</BreakpointContent>
21+
</BreakpointProxy>
22+
</Breakpoints>
23+
</Bucket>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Scheme
3+
LastUpgradeVersion = "0610"
4+
version = "1.3">
5+
<BuildAction
6+
parallelizeBuildables = "YES"
7+
buildImplicitDependencies = "YES">
8+
<BuildActionEntries>
9+
<BuildActionEntry
10+
buildForTesting = "YES"
11+
buildForRunning = "YES"
12+
buildForProfiling = "YES"
13+
buildForArchiving = "YES"
14+
buildForAnalyzing = "YES">
15+
<BuildableReference
16+
BuildableIdentifier = "primary"
17+
BlueprintIdentifier = "2D5F15581A58E534009C5D33"
18+
BuildableName = "UINavigationController10.app"
19+
BlueprintName = "UINavigationController10"
20+
ReferencedContainer = "container:UINavigationController10.xcodeproj">
21+
</BuildableReference>
22+
</BuildActionEntry>
23+
<BuildActionEntry
24+
buildForTesting = "YES"
25+
buildForRunning = "YES"
26+
buildForProfiling = "NO"
27+
buildForArchiving = "NO"
28+
buildForAnalyzing = "YES">
29+
<BuildableReference
30+
BuildableIdentifier = "primary"
31+
BlueprintIdentifier = "2D5F156D1A58E534009C5D33"
32+
BuildableName = "UINavigationController10Tests.xctest"
33+
BlueprintName = "UINavigationController10Tests"
34+
ReferencedContainer = "container:UINavigationController10.xcodeproj">
35+
</BuildableReference>
36+
</BuildActionEntry>
37+
</BuildActionEntries>
38+
</BuildAction>
39+
<TestAction
40+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
41+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
42+
shouldUseLaunchSchemeArgsEnv = "YES"
43+
buildConfiguration = "Debug">
44+
<Testables>
45+
<TestableReference
46+
skipped = "NO">
47+
<BuildableReference
48+
BuildableIdentifier = "primary"
49+
BlueprintIdentifier = "2D5F156D1A58E534009C5D33"
50+
BuildableName = "UINavigationController10Tests.xctest"
51+
BlueprintName = "UINavigationController10Tests"
52+
ReferencedContainer = "container:UINavigationController10.xcodeproj">
53+
</BuildableReference>
54+
</TestableReference>
55+
</Testables>
56+
<MacroExpansion>
57+
<BuildableReference
58+
BuildableIdentifier = "primary"
59+
BlueprintIdentifier = "2D5F15581A58E534009C5D33"
60+
BuildableName = "UINavigationController10.app"
61+
BlueprintName = "UINavigationController10"
62+
ReferencedContainer = "container:UINavigationController10.xcodeproj">
63+
</BuildableReference>
64+
</MacroExpansion>
65+
</TestAction>
66+
<LaunchAction
67+
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
68+
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
69+
launchStyle = "0"
70+
useCustomWorkingDirectory = "NO"
71+
buildConfiguration = "Debug"
72+
ignoresPersistentStateOnLaunch = "NO"
73+
debugDocumentVersioning = "YES"
74+
allowLocationSimulation = "YES">
75+
<BuildableProductRunnable>
76+
<BuildableReference
77+
BuildableIdentifier = "primary"
78+
BlueprintIdentifier = "2D5F15581A58E534009C5D33"
79+
BuildableName = "UINavigationController10.app"
80+
BlueprintName = "UINavigationController10"
81+
ReferencedContainer = "container:UINavigationController10.xcodeproj">
82+
</BuildableReference>
83+
</BuildableProductRunnable>
84+
<AdditionalOptions>
85+
</AdditionalOptions>
86+
</LaunchAction>
87+
<ProfileAction
88+
shouldUseLaunchSchemeArgsEnv = "YES"
89+
savedToolIdentifier = ""
90+
useCustomWorkingDirectory = "NO"
91+
buildConfiguration = "Release"
92+
debugDocumentVersioning = "YES">
93+
<BuildableProductRunnable>
94+
<BuildableReference
95+
BuildableIdentifier = "primary"
96+
BlueprintIdentifier = "2D5F15581A58E534009C5D33"
97+
BuildableName = "UINavigationController10.app"
98+
BlueprintName = "UINavigationController10"
99+
ReferencedContainer = "container:UINavigationController10.xcodeproj">
100+
</BuildableReference>
101+
</BuildableProductRunnable>
102+
</ProfileAction>
103+
<AnalyzeAction
104+
buildConfiguration = "Debug">
105+
</AnalyzeAction>
106+
<ArchiveAction
107+
buildConfiguration = "Release"
108+
revealArchiveInOrganizer = "YES">
109+
</ArchiveAction>
110+
</Scheme>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>SchemeUserState</key>
6+
<dict>
7+
<key>UINavigationController10.xcscheme</key>
8+
<dict>
9+
<key>orderHint</key>
10+
<integer>0</integer>
11+
</dict>
12+
</dict>
13+
<key>SuppressBuildableAutocreation</key>
14+
<dict>
15+
<key>2D5F15581A58E534009C5D33</key>
16+
<dict>
17+
<key>primary</key>
18+
<true/>
19+
</dict>
20+
<key>2D5F156D1A58E534009C5D33</key>
21+
<dict>
22+
<key>primary</key>
23+
<true/>
24+
</dict>
25+
</dict>
26+
</dict>
27+
</plist>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
//
2+
// AppDelegate.swift
3+
// UINavigationController10
4+
//
5+
// Created by Raza Master on 1/3/15.
6+
// Copyright (c) 2015 raza. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
@UIApplicationMain
12+
class AppDelegate: UIResponder, UIApplicationDelegate {
13+
14+
var window: UIWindow?
15+
16+
17+
func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool {
18+
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
19+
20+
//Override point for customization after applicaiton launch
21+
22+
//Create a BNRItemViewContoller
23+
let itemsViewController = BNRItemsTableViewController()
24+
25+
//Create an instance of a UINavigationController
26+
//its stack contains only itemsViewController
27+
let navcontroller = UINavigationController(rootViewController: itemsViewController)
28+
29+
30+
//Place BNRItemsViewController's Table view in the window hierarchy
31+
self.window!.rootViewController = navcontroller
32+
33+
self.window!.backgroundColor = UIColor.whiteColor()
34+
self.window!.makeKeyAndVisible()
35+
36+
return true
37+
38+
}
39+
40+
func applicationWillResignActive(application: UIApplication!) {
41+
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
42+
// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
43+
}
44+
45+
func applicationDidEnterBackground(application: UIApplication!) {
46+
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
47+
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
48+
}
49+
50+
func applicationWillEnterForeground(application: UIApplication!) {
51+
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
52+
}
53+
54+
func applicationDidBecomeActive(application: UIApplication!) {
55+
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
56+
}
57+
58+
func applicationWillTerminate(application: UIApplication!) {
59+
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
60+
}
61+
62+
63+
}
64+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
//
2+
// BNRDetailViewController.swift
3+
// UINavigationController10
4+
//
5+
// Created by Raza Master on 1/3/15.
6+
// Copyright (c) 2015 raza. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
class BNRDetailViewController: UIViewController {
12+
13+
@IBOutlet var dateLabel: UILabel!
14+
@IBOutlet var valueField: UITextField!
15+
@IBOutlet var serialNumberfield: UITextField!
16+
@IBOutlet var nameField: UITextField!
17+
18+
override func viewDidLoad() {
19+
super.viewDidLoad()
20+
// Do any additional setup after loading the view.
21+
}
22+
23+
override func didReceiveMemoryWarning() {
24+
super.didReceiveMemoryWarning()
25+
// Dispose of any resources that can be recreated.
26+
}
27+
28+
override init(nibName nibNameOrNil: String!, bundle nibBundleOrNil: NSBundle!) {
29+
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
30+
}
31+
32+
required init(coder aDecoder: NSCoder) {
33+
super.init(coder: aDecoder)
34+
}
35+
36+
override init() {
37+
super.init()
38+
}
39+
40+
var item = BNRItem()
41+
42+
override func viewWillAppear(animated: Bool) {
43+
super.viewWillAppear(animated)
44+
45+
self.nameField.text = item.itemName
46+
self.serialNumberfield.text = item.serialNumber
47+
self.valueField.text = "\(item.valueInDollars)"
48+
self.navigationItem.title = item.itemName
49+
50+
println(item)
51+
//We need an NSDateFormatter that will turn a date into a simple date string
52+
var dateFormatter:NSDateFormatter!
53+
if(dateFormatter == nil){
54+
dateFormatter = NSDateFormatter()
55+
dateFormatter.dateStyle = NSDateFormatterStyle.MediumStyle
56+
dateFormatter.timeStyle = NSDateFormatterStyle.NoStyle
57+
}
58+
59+
//use filtered NSdate object to set dateLabel contents
60+
self.dateLabel.text = dateFormatter.stringFromDate(item.dateCreated)
61+
62+
}
63+
64+
65+
override func viewWillDisappear(animated: Bool) {
66+
super.viewWillDisappear(true)
67+
68+
//Clear first responder
69+
self.view.endEditing(true)
70+
71+
//"Save" changes to item
72+
var item = self.item
73+
item.itemName = self.nameField.text
74+
item.serialNumber = self.serialNumberfield.text
75+
item.valueInDollars = self.valueField.text.toInt()!
76+
77+
}
78+
79+
}

0 commit comments

Comments
 (0)