Skip to content

Commit 0bfbb57

Browse files
committed
Edit Profile UI
1 parent 652cb42 commit 0bfbb57

File tree

7 files changed

+456
-7
lines changed

7 files changed

+456
-7
lines changed

Cluster.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
CEA8EA1C1B854B2100DC2AA5 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = CEA8EA1A1B854B2100DC2AA5 /* LaunchScreen.xib */; };
6767
CEA8EA281B854B2100DC2AA5 /* ClusterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEA8EA271B854B2100DC2AA5 /* ClusterTests.swift */; };
6868
CEA8EA321B854B7F00DC2AA5 /* HomeViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEA8EA311B854B7F00DC2AA5 /* HomeViewController.swift */; };
69+
CEAA8FAA1BCEFD9700004349 /* EditProfileTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEAA8FA91BCEFD9700004349 /* EditProfileTableViewController.swift */; };
6970
CEC88F141BB45772009BE41C /* SWRevealViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = CEC88F131BB45772009BE41C /* SWRevealViewController.m */; };
7071
CEC88F171BB45C10009BE41C /* MenuController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CEC88F161BB45C10009BE41C /* MenuController.swift */; };
7172
CED4489D1BA5111900F11808 /* Kluster.swift in Sources */ = {isa = PBXBuildFile; fileRef = CED4489C1BA5111900F11808 /* Kluster.swift */; };
@@ -151,6 +152,7 @@
151152
CEA8EA261B854B2100DC2AA5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
152153
CEA8EA271B854B2100DC2AA5 /* ClusterTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClusterTests.swift; sourceTree = "<group>"; };
153154
CEA8EA311B854B7F00DC2AA5 /* HomeViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HomeViewController.swift; sourceTree = "<group>"; };
155+
CEAA8FA91BCEFD9700004349 /* EditProfileTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EditProfileTableViewController.swift; sourceTree = "<group>"; };
154156
CEC88F121BB45772009BE41C /* SWRevealViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SWRevealViewController.h; sourceTree = "<group>"; };
155157
CEC88F131BB45772009BE41C /* SWRevealViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SWRevealViewController.m; sourceTree = "<group>"; };
156158
CEC88F161BB45C10009BE41C /* MenuController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MenuController.swift; sourceTree = "<group>"; };
@@ -220,6 +222,7 @@
220222
isa = PBXGroup;
221223
children = (
222224
CE8BE8FD1BB23FFE00BBEC24 /* ProfileViewController.swift */,
225+
CEAA8FA91BCEFD9700004349 /* EditProfileTableViewController.swift */,
223226
);
224227
name = "Profile Screen";
225228
sourceTree = "<group>";
@@ -525,6 +528,7 @@
525528
CE9C42EB1BC081F100504B69 /* ImagePreviewFlowLayout.swift in Sources */,
526529
CE9C42EA1BC081F100504B69 /* ImagePickerSheetController.swift in Sources */,
527530
CEC88F141BB45772009BE41C /* SWRevealViewController.m in Sources */,
531+
CEAA8FAA1BCEFD9700004349 /* EditProfileTableViewController.swift in Sources */,
528532
CE8BE91F1BB2448C00BBEC24 /* AsyncButton.swift in Sources */,
529533
CE8BE92C1BB2448C00BBEC24 /* KeyboardLayoutConstraint.swift in Sources */,
530534
CE8BE9231BB2448C00BBEC24 /* DesignableButton.swift in Sources */,
Binary file not shown.

Cluster/Base.lproj/Main.storyboard

Lines changed: 287 additions & 7 deletions
Large diffs are not rendered by default.
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
//
2+
// EditProfileTableViewController.swift
3+
// Cluster
4+
//
5+
// Created by lsecrease on 10/14/15.
6+
// Copyright (c) 2015 ImagineME. All rights reserved.
7+
//
8+
9+
import UIKit
10+
import Photos
11+
12+
class EditProfileTableViewController: UITableViewController, UIImagePickerControllerDelegate, UINavigationControllerDelegate {
13+
14+
@IBOutlet weak var coverImage: UIImageView!
15+
@IBOutlet weak var profileImage: UIImageView!
16+
@IBOutlet weak var profileImageOverlay: UIVisualEffectView!
17+
@IBOutlet weak var aboutMeTextView: UITextView!
18+
19+
private var profilePic: UIImage!
20+
private var coverPic: UIImage!
21+
22+
let numberOfRowsAtSection: [Int] = [4, 2]
23+
24+
//MARK: - Change Status Bar to White
25+
override func preferredStatusBarStyle() -> UIStatusBarStyle {
26+
return .LightContent
27+
}
28+
29+
override func viewDidLoad() {
30+
super.viewDidLoad()
31+
32+
profileImage.layer.cornerRadius = profileImage.bounds.width / 2
33+
profileImage.layer.masksToBounds = true
34+
35+
profileImageOverlay.layer.cornerRadius = profileImageOverlay.bounds.width / 2
36+
profileImageOverlay.layer.masksToBounds = true
37+
38+
39+
}
40+
41+
42+
43+
// MARK: - Table view data source
44+
45+
override func numberOfSectionsInTableView(tableView: UITableView) -> Int {
46+
// #warning Potentially incomplete method implementation.
47+
// Return the number of sections.
48+
return 2
49+
}
50+
51+
override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
52+
var rows: Int = 0
53+
54+
if section < numberOfRowsAtSection.count {
55+
rows = numberOfRowsAtSection[section]
56+
}
57+
58+
return rows
59+
60+
}
61+
62+
@IBAction func profileImageChange(sender: DesignableButton) {
63+
64+
let authorization = PHPhotoLibrary.authorizationStatus()
65+
66+
if authorization == .NotDetermined {
67+
PHPhotoLibrary.requestAuthorization({ (status) -> Void in
68+
//self.pickFeaturedImageClicked(sender)
69+
dispatch_async(dispatch_get_main_queue(), { () -> Void in
70+
self.profileImageChange(sender)
71+
})
72+
})
73+
return
74+
}
75+
//Do you want to Take a Photo or Video with the Camera
76+
if authorization == .Authorized {
77+
let controller = ImagePickerSheetController()
78+
controller.addAction(ImageAction(title: NSLocalizedString("Take Photo or Video", comment: "ActionTitle"), secondaryTitle: NSLocalizedString("Use This One", comment: "ActionTitle"), handler: { (_) -> () in
79+
80+
self.presentCamera()
81+
82+
}, secondaryHandler: { (action, numberOfPhotos) -> () in
83+
controller.getSelectedImagesWithCompletion({ (images) -> Void in
84+
self.profilePic = images[0]
85+
self.profileImage.image = self.profilePic
86+
})
87+
}))
88+
89+
controller.addAction(ImageAction(title: NSLocalizedString("Cancel", comment: "Action Title"), style: .Cancel))
90+
91+
presentViewController(controller, animated: true, completion: nil)
92+
93+
}
94+
}
95+
@IBAction func coverImageChange(sender: DesignableButton) {
96+
97+
let authorization = PHPhotoLibrary.authorizationStatus()
98+
99+
if authorization == .NotDetermined {
100+
PHPhotoLibrary.requestAuthorization({ (status) -> Void in
101+
//self.pickFeaturedImageClicked(sender)
102+
dispatch_async(dispatch_get_main_queue(), { () -> Void in
103+
self.profileImageChange(sender)
104+
})
105+
})
106+
return
107+
}
108+
//Do you want to Take a Photo or Video with the Camera
109+
if authorization == .Authorized {
110+
let controller = ImagePickerSheetController()
111+
controller.addAction(ImageAction(title: NSLocalizedString("Take Photo or Video", comment: "ActionTitle"), secondaryTitle: NSLocalizedString("Use This One", comment: "ActionTitle"), handler: { (_) -> () in
112+
113+
self.presentCamera()
114+
115+
}, secondaryHandler: { (action, numberOfPhotos) -> () in
116+
controller.getSelectedImagesWithCompletion({ (images) -> Void in
117+
self.coverPic = images[0]
118+
self.coverImage.image = self.coverPic
119+
})
120+
}))
121+
122+
controller.addAction(ImageAction(title: NSLocalizedString("Cancel", comment: "Action Title"), style: .Cancel))
123+
124+
presentViewController(controller, animated: true, completion: nil)
125+
126+
}
127+
128+
}
129+
130+
func presentCamera() {
131+
let imagePicker = UIImagePickerController()
132+
imagePicker.allowsEditing = false
133+
imagePicker.delegate = self
134+
imagePicker.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
135+
self.presentViewController(imagePicker, animated: true, completion: nil)
136+
}
137+
138+
@IBAction func deleteAccountButtonTapped(sender: DesignableButton) {
139+
140+
println("Delete Account Button Tapped")
141+
}
142+
143+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"images" : [
3+
{
4+
"idiom" : "universal",
5+
"scale" : "1x",
6+
"filename" : "Icon.png"
7+
},
8+
{
9+
"idiom" : "universal",
10+
"scale" : "2x"
11+
},
12+
{
13+
"idiom" : "universal",
14+
"scale" : "3x"
15+
}
16+
],
17+
"info" : {
18+
"version" : 1,
19+
"author" : "xcode"
20+
}
21+
}
589 Bytes
Loading

Cluster/ProfileViewController.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class ProfileViewController: UIViewController {
3030
override func viewDidLoad() {
3131
super.viewDidLoad()
3232

33+
//Side Menu
3334
if self.revealViewController() != nil {
3435
menuButton.addTarget(self.revealViewController(), action: "revealToggle:", forControlEvents: UIControlEvents.TouchUpInside)
3536
self.view.addGestureRecognizer(self.revealViewController().panGestureRecognizer())

0 commit comments

Comments
 (0)