Skip to content

Commit 4e0ff61

Browse files
committed
Added location select
1 parent 3979763 commit 4e0ff61

File tree

12 files changed

+138
-24
lines changed

12 files changed

+138
-24
lines changed

Cluster.xcodeproj/project.pbxproj

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,15 @@
5858
9D2EFA411BF6534400D91812 /* KlusterSearchController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D2EFA401BF6534400D91812 /* KlusterSearchController.swift */; };
5959
9D7CC5AB1C7E7958002D21D0 /* MessageTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D7CC5AA1C7E7958002D21D0 /* MessageTextView.swift */; };
6060
9D7CC5AD1C7E8EFB002D21D0 /* Message.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9D7CC5AC1C7E8EFB002D21D0 /* Message.swift */; };
61+
9DB9900C1C8009B400837993 /* MessagesTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9DB9900B1C8009B400837993 /* MessagesTableViewController.swift */; };
62+
9DB9900E1C800A4E00837993 /* Map.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9DB9900D1C800A4E00837993 /* Map.storyboard */; };
63+
9DB990131C800B9000837993 /* LocationSelectViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9DB990121C800B9000837993 /* LocationSelectViewController.swift */; };
64+
9DB990151C800FA000837993 /* MapKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9DB990141C800FA000837993 /* MapKit.framework */; };
6165
9DBA246E1BE14A14005D6AD6 /* MessageTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9DBA246D1BE14A14005D6AD6 /* MessageTableViewCell.swift */; };
6266
9DBA24701BE152F3005D6AD6 /* MembersTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9DBA246F1BE152F3005D6AD6 /* MembersTableViewCell.swift */; };
6367
9DBA24721BE2B26D005D6AD6 /* LoginViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9DBA24711BE2B26D005D6AD6 /* LoginViewController.swift */; };
6468
9DBA24741BE2B2D2005D6AD6 /* Login.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 9DBA24731BE2B2D2005D6AD6 /* Login.storyboard */; };
6569
CE0413501BD88B8300BED627 /* MembersTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE04134F1BD88B8300BED627 /* MembersTableViewController.swift */; };
66-
CE0413521BD88CEB00BED627 /* MessagesTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE0413511BD88CEB00BED627 /* MessagesTableViewController.swift */; };
6770
CE0F3C541BD729D20012B7D7 /* KlusterHeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE0F3C531BD729D20012B7D7 /* KlusterHeaderView.swift */; };
6871
CE14D6551BD809A100FC06F4 /* CAPSPageMenu.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE14D6541BD809A100FC06F4 /* CAPSPageMenu.swift */; };
6972
CE89911D1B8A614B00B2B6BC /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = CE89911C1B8A614B00B2B6BC /* AudioToolbox.framework */; };
@@ -158,14 +161,17 @@
158161
9D2EFA401BF6534400D91812 /* KlusterSearchController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KlusterSearchController.swift; sourceTree = "<group>"; };
159162
9D7CC5AA1C7E7958002D21D0 /* MessageTextView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageTextView.swift; sourceTree = "<group>"; };
160163
9D7CC5AC1C7E8EFB002D21D0 /* Message.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Message.swift; sourceTree = "<group>"; };
164+
9DB9900B1C8009B400837993 /* MessagesTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessagesTableViewController.swift; sourceTree = "<group>"; };
165+
9DB9900D1C800A4E00837993 /* Map.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Map.storyboard; sourceTree = "<group>"; };
166+
9DB990121C800B9000837993 /* LocationSelectViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LocationSelectViewController.swift; sourceTree = "<group>"; };
167+
9DB990141C800FA000837993 /* MapKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MapKit.framework; path = System/Library/Frameworks/MapKit.framework; sourceTree = SDKROOT; };
161168
9DBA246D1BE14A14005D6AD6 /* MessageTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessageTableViewCell.swift; sourceTree = "<group>"; };
162169
9DBA246F1BE152F3005D6AD6 /* MembersTableViewCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MembersTableViewCell.swift; sourceTree = "<group>"; };
163170
9DBA24711BE2B26D005D6AD6 /* LoginViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LoginViewController.swift; sourceTree = "<group>"; };
164171
9DBA24731BE2B2D2005D6AD6 /* Login.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Login.storyboard; sourceTree = "<group>"; };
165172
B255B4D666AF91CF21B4DDEE /* libPods.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libPods.a; sourceTree = BUILT_PRODUCTS_DIR; };
166173
BF30D58564BAC072F96024A4 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
167174
CE04134F1BD88B8300BED627 /* MembersTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MembersTableViewController.swift; sourceTree = "<group>"; };
168-
CE0413511BD88CEB00BED627 /* MessagesTableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MessagesTableViewController.swift; sourceTree = "<group>"; };
169175
CE0F3C531BD729D20012B7D7 /* KlusterHeaderView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KlusterHeaderView.swift; sourceTree = "<group>"; };
170176
CE14D6541BD809A100FC06F4 /* CAPSPageMenu.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CAPSPageMenu.swift; sourceTree = "<group>"; };
171177
CE89911C1B8A614B00B2B6BC /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
@@ -207,14 +213,15 @@
207213
isa = PBXFrameworksBuildPhase;
208214
buildActionMask = 2147483647;
209215
files = (
216+
9DB990151C800FA000837993 /* MapKit.framework in Frameworks */,
217+
CE8991231B8A616000B2B6BC /* CoreLocation.framework in Frameworks */,
210218
CE8991311B8A61A200B2B6BC /* libsqlite3.dylib in Frameworks */,
211219
CE89912F1B8A619900B2B6BC /* SystemConfiguration.framework in Frameworks */,
212220
CE89912D1B8A618E00B2B6BC /* StoreKit.framework in Frameworks */,
213221
CE89912B1B8A618700B2B6BC /* Security.framework in Frameworks */,
214222
CE8991291B8A618000B2B6BC /* QuartzCore.framework in Frameworks */,
215223
CE8991271B8A617600B2B6BC /* MobileCoreServices.framework in Frameworks */,
216224
CE8991251B8A616B00B2B6BC /* libz.dylib in Frameworks */,
217-
CE8991231B8A616000B2B6BC /* CoreLocation.framework in Frameworks */,
218225
CE8991211B8A615A00B2B6BC /* CoreGraphics.framework in Frameworks */,
219226
CE89911F1B8A615300B2B6BC /* CFNetwork.framework in Frameworks */,
220227
CE89911D1B8A614B00B2B6BC /* AudioToolbox.framework in Frameworks */,
@@ -346,6 +353,7 @@
346353
B7F7862424CD11C144F1CC5E /* Frameworks */ = {
347354
isa = PBXGroup;
348355
children = (
356+
9DB990141C800FA000837993 /* MapKit.framework */,
349357
CE8991301B8A61A200B2B6BC /* libsqlite3.dylib */,
350358
CE89912E1B8A619900B2B6BC /* SystemConfiguration.framework */,
351359
CE89912C1B8A618E00B2B6BC /* StoreKit.framework */,
@@ -407,13 +415,13 @@
407415
CEA8EA0E1B854B2100DC2AA5 /* Cluster */ = {
408416
isa = PBXGroup;
409417
children = (
418+
9DB9900B1C8009B400837993 /* MessagesTableViewController.swift */,
410419
9DEFE5D91C73E601005B3B1A /* Models */,
411420
9DEFE5D81C73E5FB005B3B1A /* Controllers */,
412421
9DEFE5D71C73E5F5005B3B1A /* Views */,
413422
CEA8EA111B854B2100DC2AA5 /* AppDelegate.swift */,
414423
CEC88F161BB45C10009BE41C /* MenuController.swift */,
415424
CE14D6541BD809A100FC06F4 /* CAPSPageMenu.swift */,
416-
CE0413511BD88CEB00BED627 /* MessagesTableViewController.swift */,
417425
9DBA246D1BE14A14005D6AD6 /* MessageTableViewCell.swift */,
418426
CE04134F1BD88B8300BED627 /* MembersTableViewController.swift */,
419427
9DBA246F1BE152F3005D6AD6 /* MembersTableViewCell.swift */,
@@ -436,6 +444,8 @@
436444
9D2EFA3C1BF6257000D91812 /* KlusterDataSource.swift */,
437445
9D2EFA3E1BF6344E00D91812 /* KlusterImageResizer.swift */,
438446
9D2EFA401BF6534400D91812 /* KlusterSearchController.swift */,
447+
9DB9900D1C800A4E00837993 /* Map.storyboard */,
448+
9DB990121C800B9000837993 /* LocationSelectViewController.swift */,
439449
);
440450
path = Cluster;
441451
sourceTree = "<group>";
@@ -585,6 +595,7 @@
585595
CEA8EA171B854B2100DC2AA5 /* Main.storyboard in Resources */,
586596
28EE23521BDF1F83009161AE /* LoadingView.xib in Resources */,
587597
CEA8EA1C1B854B2100DC2AA5 /* LaunchScreen.xib in Resources */,
598+
9DB9900E1C800A4E00837993 /* Map.storyboard in Resources */,
588599
CEA8EA191B854B2100DC2AA5 /* Images.xcassets in Resources */,
589600
9DBA24741BE2B2D2005D6AD6 /* Login.storyboard in Resources */,
590601
);
@@ -693,6 +704,7 @@
693704
CEC1E7441BD7515F00203E41 /* KlusterViewController.swift in Sources */,
694705
CED448A21BA5153800F11808 /* KlusterCollectionViewCell.swift in Sources */,
695706
CEC88F171BB45C10009BE41C /* MenuController.swift in Sources */,
707+
9DB990131C800B9000837993 /* LocationSelectViewController.swift in Sources */,
696708
9D2EFA3D1BF6257000D91812 /* KlusterDataSource.swift in Sources */,
697709
28EE23441BDF1F83009161AE /* AsyncImageView.swift in Sources */,
698710
28EE23431BDF1F83009161AE /* AsyncButton.swift in Sources */,
@@ -701,7 +713,6 @@
701713
28EE235E1BDF1F83009161AE /* TransitionZoom.swift in Sources */,
702714
28ADC5C61BF9350F001599D5 /* KlusterInviteViewController.swift in Sources */,
703715
9D7CC5AD1C7E8EFB002D21D0 /* Message.swift in Sources */,
704-
CE0413521BD88CEB00BED627 /* MessagesTableViewController.swift in Sources */,
705716
28EE23481BDF1F83009161AE /* DesignableImageView.swift in Sources */,
706717
9DBA24701BE152F3005D6AD6 /* MembersTableViewCell.swift in Sources */,
707718
28EE23751BDF1FF9009161AE /* PreviewSupplementaryView.swift in Sources */,
@@ -711,6 +722,7 @@
711722
28ADC5C81BF9385B001599D5 /* KlusterInviteTableViewCell.swift in Sources */,
712723
28EE23591BDF1F83009161AE /* SpringLabel.swift in Sources */,
713724
28EE23571BDF1F83009161AE /* SpringButton.swift in Sources */,
725+
9DB9900C1C8009B400837993 /* MessagesTableViewController.swift in Sources */,
714726
CE0F3C541BD729D20012B7D7 /* KlusterHeaderView.swift in Sources */,
715727
287147851BFAEFB6007FDB36 /* NotificationsViewController.swift in Sources */,
716728
28EE23491BDF1F83009161AE /* DesignableLabel.swift in Sources */,
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
//
2+
// LocationSelectViewController.swift
3+
// Cluster
4+
//
5+
// Created by Michael Fellows on 2/25/16.
6+
// Copyright © 2016 ImagineME. All rights reserved.
7+
//
8+
9+
import Foundation
10+
import MapKit
11+
12+
13+
class LocationSelectViewController: UIViewController {
14+
15+
@IBOutlet var mapView: MKMapView!
16+
17+
public var completion: (String? -> ())?
18+
19+
override func viewDidLoad() {
20+
super.viewDidLoad()
21+
}
22+
23+
@IBAction func cancelButtonPressed(sender: AnyObject) {
24+
self.dismissViewControllerAnimated(true, completion: nil)
25+
}
26+
27+
@IBAction func doneButtonPressed(sender: AnyObject) {
28+
29+
}
30+
}

Cluster/Map.storyboard

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES">
3+
<dependencies>
4+
<deployment identifier="iOS"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530"/>
6+
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
7+
</dependencies>
8+
<scenes>
9+
<!--Pick A Location-->
10+
<scene sceneID="pay-Ii-aR7">
11+
<objects>
12+
<viewController id="11e-Xg-zx8" customClass="LocationSelectViewController" customModule="Cluster" customModuleProvider="target" sceneMemberID="viewController">
13+
<layoutGuides>
14+
<viewControllerLayoutGuide type="top" id="Owv-TX-anP"/>
15+
<viewControllerLayoutGuide type="bottom" id="eDc-Yw-rxW"/>
16+
</layoutGuides>
17+
<view key="view" contentMode="scaleToFill" id="Aj5-aB-Nj6">
18+
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
19+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
20+
<subviews>
21+
<mapView clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" mapType="standard" showsUserLocation="YES" translatesAutoresizingMaskIntoConstraints="NO" id="LJ9-LT-yNh">
22+
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
23+
</mapView>
24+
</subviews>
25+
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
26+
<constraints>
27+
<constraint firstItem="LJ9-LT-yNh" firstAttribute="leading" secondItem="Aj5-aB-Nj6" secondAttribute="leadingMargin" constant="-20" id="Fte-w1-4dj"/>
28+
<constraint firstItem="LJ9-LT-yNh" firstAttribute="top" secondItem="Aj5-aB-Nj6" secondAttribute="topMargin" id="GBB-YW-PTq"/>
29+
<constraint firstAttribute="trailingMargin" secondItem="LJ9-LT-yNh" secondAttribute="trailing" constant="-20" id="IXe-5v-xtu"/>
30+
<constraint firstItem="eDc-Yw-rxW" firstAttribute="top" secondItem="LJ9-LT-yNh" secondAttribute="bottom" id="ycm-IQ-bxm"/>
31+
</constraints>
32+
</view>
33+
<navigationItem key="navigationItem" title="Pick A Location" id="9is-9L-24O">
34+
<barButtonItem key="leftBarButtonItem" title="Cancel" id="vR8-Ct-dbz">
35+
<connections>
36+
<action selector="cancelButtonPressed:" destination="11e-Xg-zx8" id="fkf-7a-urm"/>
37+
</connections>
38+
</barButtonItem>
39+
<barButtonItem key="rightBarButtonItem" title="Done" id="NG8-QI-deB">
40+
<connections>
41+
<action selector="doneButtonPressed:" destination="11e-Xg-zx8" id="VLB-PS-DfO"/>
42+
</connections>
43+
</barButtonItem>
44+
</navigationItem>
45+
<connections>
46+
<outlet property="mapView" destination="LJ9-LT-yNh" id="H8Z-fw-jc8"/>
47+
</connections>
48+
</viewController>
49+
<placeholder placeholderIdentifier="IBFirstResponder" id="XhS-tg-gzm" userLabel="First Responder" sceneMemberID="firstResponder"/>
50+
</objects>
51+
<point key="canvasLocation" x="1453" y="637"/>
52+
</scene>
53+
<!--Navigation Controller-->
54+
<scene sceneID="1hH-AD-rdb">
55+
<objects>
56+
<navigationController id="WED-3T-02Y" sceneMemberID="viewController">
57+
<navigationBar key="navigationBar" contentMode="scaleToFill" id="E1S-Q6-rrZ">
58+
<rect key="frame" x="0.0" y="0.0" width="320" height="44"/>
59+
<autoresizingMask key="autoresizingMask"/>
60+
</navigationBar>
61+
<connections>
62+
<segue destination="11e-Xg-zx8" kind="relationship" relationship="rootViewController" id="7yV-Qa-aYs"/>
63+
</connections>
64+
</navigationController>
65+
<placeholder placeholderIdentifier="IBFirstResponder" id="qqu-Dc-kvm" userLabel="First Responder" sceneMemberID="firstResponder"/>
66+
</objects>
67+
<point key="canvasLocation" x="754" y="727"/>
68+
</scene>
69+
</scenes>
70+
</document>

Cluster/MessagesTableViewController.swift

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ class MessagesTableViewController: UITableViewController {
1414

1515
var kluster: Kluster!
1616
var textView: MessageTextView!
17-
var keyboardAppeared = false
1817
let textViewHeight = 60.0 as CGFloat
1918
var messages = [PFObject]()
19+
let windowHeight: CGFloat? = UIApplication.sharedApplication().keyWindow?.frame.size.height
2020

2121
// init(style: UITableViewStyle) {
2222
// super.init(tableViewStyle: .Plain)
@@ -32,7 +32,6 @@ class MessagesTableViewController: UITableViewController {
3232
self.fetchMessages()
3333

3434
// Update the keyboard status
35-
self.keyboardAppeared = false
3635
self.textView = MessageTextView.init(frame: self.originalFrame())
3736
self.textView.sendButton.addTarget(self, action: "sendPressed:", forControlEvents: .TouchUpInside)
3837
UIApplication.sharedApplication().keyWindow?.addSubview(self.textView)
@@ -143,17 +142,17 @@ class MessagesTableViewController: UITableViewController {
143142
// MARK: - Notifications
144143

145144
func keyboardWillShowNotification(notification: NSNotification) {
146-
updateBottomLayoutConstraintWithNotification(notification)
145+
updateBottomLayoutConstraintWithNotification(notification, hide: false)
147146
}
148147

149148
func keyboardWillHideNotification(notification: NSNotification) {
150-
updateBottomLayoutConstraintWithNotification(notification)
149+
updateBottomLayoutConstraintWithNotification(notification, hide: true)
151150
}
152151

153152

154153
// MARK: - Private
155154

156-
func updateBottomLayoutConstraintWithNotification(notification: NSNotification) {
155+
func updateBottomLayoutConstraintWithNotification(notification: NSNotification, hide: Bool) {
157156
let userInfo = notification.userInfo!
158157

159158
let animationDuration = (userInfo[UIKeyboardAnimationDurationUserInfoKey] as! NSNumber).doubleValue
@@ -162,18 +161,18 @@ class MessagesTableViewController: UITableViewController {
162161
let rawAnimationCurve = (notification.userInfo![UIKeyboardAnimationCurveUserInfoKey] as! NSNumber).unsignedIntValue << 16
163162
let animationCurve = UIViewAnimationOptions(rawValue: UInt(rawAnimationCurve))
164163

164+
print("Converted keyboard end frame height: %f", convertedKeyboardEndFrame.size.height)
165+
165166
UIView.animateWithDuration(animationDuration, delay: 0.0, options: animationCurve, animations: { () -> Void in
166167
var frame = self.textView.frame
167-
if (self.keyboardAppeared) {
168-
frame.origin.y += keyboardEndFrame.size.height
168+
if (hide) {
169+
// Bring the textView back to it's original frame
170+
self.textView.frame = self.originalFrame()
169171
} else {
170-
frame.origin.y -= keyboardEndFrame.size.height
172+
frame.origin.y = self.windowHeight! - convertedKeyboardEndFrame.size.height - self.textViewHeight
173+
self.textView.frame = frame
171174
}
172-
self.textView.frame = frame
173-
self.keyboardAppeared = !self.keyboardAppeared
174-
175175
}) { (finished) -> Void in
176-
177176
}
178177
}
179178

Cluster/NewKlusterViewController.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ class NewKlusterViewController: UIViewController, UIImagePickerControllerDelegat
8686
}
8787

8888
@IBAction func chooseLocationButtonClicked(sender: DesignableButton) {
89+
let storyboard = UIStoryboard.init(name: "Map", bundle: nil)
90+
let mapController = storyboard.instantiateInitialViewController()
91+
self.presentViewController(mapController!, animated: true, completion: nil)
8992
}
9093
@IBAction func selectFeaturedImageButtonClicked(sender: DesignableButton) {
9194

0 commit comments

Comments
 (0)