Skip to content

Commit 063194c

Browse files
committed
Chapter 6
Chapter 6 and project names
1 parent fda1441 commit 063194c

File tree

71 files changed

+1197
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1197
-0
lines changed

06-ViewControllers/06Chapter.xcodeproj/project.pbxproj

+432
Large diffs are not rendered by default.

06-ViewControllers/06Chapter.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,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 = "2DE3E8DD1A58D48F00845C30"
18+
BuildableName = "06Chapter.app"
19+
BlueprintName = "06Chapter"
20+
ReferencedContainer = "container:06Chapter.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 = "2DE3E8F21A58D48F00845C30"
32+
BuildableName = "06ChapterTests.xctest"
33+
BlueprintName = "06ChapterTests"
34+
ReferencedContainer = "container:06Chapter.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 = "2DE3E8F21A58D48F00845C30"
50+
BuildableName = "06ChapterTests.xctest"
51+
BlueprintName = "06ChapterTests"
52+
ReferencedContainer = "container:06Chapter.xcodeproj">
53+
</BuildableReference>
54+
</TestableReference>
55+
</Testables>
56+
<MacroExpansion>
57+
<BuildableReference
58+
BuildableIdentifier = "primary"
59+
BlueprintIdentifier = "2DE3E8DD1A58D48F00845C30"
60+
BuildableName = "06Chapter.app"
61+
BlueprintName = "06Chapter"
62+
ReferencedContainer = "container:06Chapter.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 = "2DE3E8DD1A58D48F00845C30"
79+
BuildableName = "06Chapter.app"
80+
BlueprintName = "06Chapter"
81+
ReferencedContainer = "container:06Chapter.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 = "2DE3E8DD1A58D48F00845C30"
97+
BuildableName = "06Chapter.app"
98+
BlueprintName = "06Chapter"
99+
ReferencedContainer = "container:06Chapter.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>06Chapter.xcscheme</key>
8+
<dict>
9+
<key>orderHint</key>
10+
<integer>0</integer>
11+
</dict>
12+
</dict>
13+
<key>SuppressBuildableAutocreation</key>
14+
<dict>
15+
<key>2DE3E8DD1A58D48F00845C30</key>
16+
<dict>
17+
<key>primary</key>
18+
<true/>
19+
</dict>
20+
<key>2DE3E8F21A58D48F00845C30</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,68 @@
1+
//
2+
// AppDelegate.swift
3+
// 06Chapter
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+
// Override point for customization after application launch.
19+
20+
21+
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
22+
23+
let notificationSettings = UIUserNotificationSettings(forTypes:
24+
UIUserNotificationType.Alert, categories: nil)
25+
UIApplication.sharedApplication().registerUserNotificationSettings(notificationSettings)
26+
27+
var hvc = BNRHypnosisViewController(nibName: "BNRHypnosisViewController", bundle: NSBundle.mainBundle())
28+
//self.window!.rootViewController = hvc
29+
30+
var rvc = BNRReminderViewController(nibName: "BNRReminderViewController", bundle: NSBundle.mainBundle())
31+
//self.window!.rootViewController = rvc
32+
33+
var tabBarController = UITabBarController()
34+
tabBarController.viewControllers = [hvc, rvc]
35+
36+
self.window!.rootViewController = tabBarController
37+
38+
self.window!.backgroundColor = UIColor.whiteColor()
39+
self.window!.makeKeyAndVisible()
40+
41+
return true
42+
}
43+
44+
func applicationWillResignActive(application: UIApplication!) {
45+
// 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.
46+
// 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.
47+
}
48+
49+
func applicationDidEnterBackground(application: UIApplication!) {
50+
// 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.
51+
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
52+
}
53+
54+
func applicationWillEnterForeground(application: UIApplication!) {
55+
// 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.
56+
}
57+
58+
func applicationDidBecomeActive(application: UIApplication!) {
59+
// 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.
60+
}
61+
62+
func applicationWillTerminate(application: UIApplication!) {
63+
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
64+
}
65+
66+
67+
}
68+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
//
2+
// BNRHypnosisView.swift
3+
// Chap4
4+
//
5+
// Created by PanaCloud on 7/17/14.
6+
// Copyright (c) 2014 PanaCloud. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
class BNRHypnosisView: UIView {
12+
13+
override init(frame: CGRect) {
14+
super.init(frame: frame)
15+
// Initialization code
16+
17+
//All BNRHyponosisView starts with a clear background Color
18+
self.backgroundColor = UIColor.clearColor()
19+
20+
var circleColor:UIColor = UIColor.lightGrayColor()
21+
}
22+
23+
required init(coder aDecoder: NSCoder) {
24+
super.init(coder: aDecoder)
25+
// Initialization. code
26+
27+
//All BNRHyponosisView starts with a clear background Color
28+
self.backgroundColor = UIColor.clearColor()
29+
30+
var circleColor:UIColor = UIColor.lightGrayColor()
31+
}
32+
33+
var circleColor:UIColor = UIColor.lightGrayColor()
34+
35+
36+
override func drawRect(rect: CGRect) {
37+
var bounds = self.bounds
38+
39+
//figure out the center of the bounds rectangle
40+
var center = CGPoint()
41+
center.x = (bounds.origin.x + bounds.size.width) / 2.0
42+
center.y = (bounds.origin.y + bounds.size.height) / 2.0
43+
44+
/*//The circle will be the largest that will fit in the view
45+
var radius:CGFloat = hypot(bounds.size.width, bounds.size.height)/4.0
46+
*/
47+
48+
var path = UIBezierPath()
49+
50+
/*//Add an arc to the path at center, with radius of radius,
51+
//from 0 to 2*PI randian (a circle)
52+
var startAngle:CGFloat = 0.0
53+
path.addArcWithCenter(center, radius: radius, startAngle: startAngle, endAngle: Float(M_PI)*2.0, clockwise: true)
54+
*/
55+
56+
var maxRadius = hypot(bounds.size.width, bounds.size.height)/2.0
57+
58+
for(var currentRadius = maxRadius; currentRadius > 0; currentRadius -= 20){
59+
path.moveToPoint(CGPointMake(center.x + currentRadius, center.y))
60+
61+
var startAngle:CGFloat = 0.0
62+
63+
path.addArcWithCenter(center,
64+
radius:currentRadius, // Note this is currentRadius!
65+
startAngle: startAngle,
66+
endAngle: CGFloat(M_PI)*2.0, clockwise: true)
67+
68+
}
69+
70+
///Congigure line width to 10 points
71+
path.lineWidth = 10
72+
73+
//Configure the drawing color to light gray
74+
self.circleColor.setStroke()
75+
76+
//draw the line
77+
path.stroke()
78+
79+
// --- END CHAPTER # 4 //
80+
81+
82+
}
83+
84+
override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
85+
//get 3 random number b/w 0 and 1
86+
var red:CGFloat = (CGFloat(arc4random()) % 100.0) / 100.0
87+
var green:CGFloat = (CGFloat(arc4random()) % 100.0) / 100.0
88+
var blue:CGFloat = (CGFloat(arc4random()) % 100.0) / 100.0
89+
90+
var randomColor = UIColor(red: red, green: green, blue: blue, alpha: 1.0)
91+
self.circleColor = randomColor
92+
self.setNeedsDisplay()
93+
}
94+
95+
96+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
//
2+
// BNRHypnosisViewController.swift
3+
// Chap6
4+
//
5+
// Created by PanaCloud on 7/17/14.
6+
// Copyright (c) 2014 PanaCloud. All rights reserved.
7+
//
8+
9+
import UIKit
10+
11+
class BNRHypnosisViewController: UIViewController {
12+
13+
override init(nibName nibNameOrNil: String!, bundle nibBundleOrNil: NSBundle!) {
14+
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
15+
16+
//Set the tab bar item's title
17+
self.tabBarItem.title = "Hypnotize"
18+
19+
//Create a UIImage from a file
20+
var i = UIImage(named: "Hypno")
21+
22+
//Put that image on the tab bar item
23+
self.tabBarItem.image = i
24+
}
25+
26+
required init(coder aDecoder: NSCoder) {
27+
super.init(coder: aDecoder)
28+
29+
//Set the tab bar item's title
30+
self.tabBarItem.title = "Hypnotize"
31+
32+
//Create a UIImage from a file
33+
var i = UIImage(named: "Hypno")
34+
35+
//Put that image on the tab bar item
36+
self.tabBarItem.image = i
37+
}
38+
39+
override func viewDidLoad() {
40+
super.viewDidLoad()
41+
42+
// Do any additional setup after loading the view.
43+
44+
45+
}
46+
47+
override func loadView() {
48+
var backgroundView = BNRHypnosisView(frame: CGRectMake(0, 0, 320, 568))
49+
self.view = backgroundView
50+
}
51+
52+
override func didReceiveMemoryWarning() {
53+
super.didReceiveMemoryWarning()
54+
// Dispose of any resources that can be recreated.
55+
}
56+
57+
58+
/*
59+
// #pragma mark - Navigation
60+
61+
// In a storyboard-based application, you will often want to do a little preparation before navigation
62+
override func prepareForSegue(segue: UIStoryboardSegue!, sender: AnyObject!) {
63+
// Get the new view controller using segue.destinationViewController.
64+
// Pass the selected object to the new view controller.
65+
}
66+
*/
67+
68+
}

0 commit comments

Comments
 (0)