Skip to content

Commit b218bb9

Browse files
Sachin KesirajuSachin Kesiraju
authored andcommitted
Fixed minor issue.
1 parent 30b3c21 commit b218bb9

File tree

4 files changed

+83
-44
lines changed

4 files changed

+83
-44
lines changed

SwiftExample.xcodeproj/project.pbxproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
031A8D8A193DB57D00F4A6D2 /* SwiftExampleTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 031A8D89193DB57D00F4A6D2 /* SwiftExampleTests.swift */; };
1515
031A8D94193DCBE900F4A6D2 /* TableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 031A8D93193DCBE900F4A6D2 /* TableViewController.swift */; };
1616
031A8D9A193DDD4100F4A6D2 /* WebViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 031A8D99193DDD4100F4A6D2 /* WebViewController.swift */; };
17-
0356839119498B730039E42D /* MapViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0356839019498B730039E42D /* MapViewController.swift */; };
1817
03B0EEB119595EF00048D16D /* CameraViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 03B0EEB019595EF00048D16D /* CameraViewController.swift */; };
1918
03C94697195AC0C70055D2FC /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 03C94696195AC0C70055D2FC /* MobileCoreServices.framework */; };
2019
/* End PBXBuildFile section */
@@ -41,7 +40,6 @@
4140
031A8D89193DB57D00F4A6D2 /* SwiftExampleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SwiftExampleTests.swift; sourceTree = "<group>"; };
4241
031A8D93193DCBE900F4A6D2 /* TableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableViewController.swift; sourceTree = "<group>"; };
4342
031A8D99193DDD4100F4A6D2 /* WebViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = WebViewController.swift; sourceTree = "<group>"; };
44-
0356839019498B730039E42D /* MapViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MapViewController.swift; sourceTree = "<group>"; };
4543
03B0EEB019595EF00048D16D /* CameraViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CameraViewController.swift; sourceTree = "<group>"; };
4644
03C94696195AC0C70055D2FC /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; };
4745
/* End PBXFileReference section */
@@ -91,7 +89,6 @@
9189
031A8D78193DB57D00F4A6D2 /* ViewController.swift */,
9290
031A8D7A193DB57D00F4A6D2 /* Main.storyboard */,
9391
03B0EEB019595EF00048D16D /* CameraViewController.swift */,
94-
0356839019498B730039E42D /* MapViewController.swift */,
9592
031A8D99193DDD4100F4A6D2 /* WebViewController.swift */,
9693
031A8D93193DCBE900F4A6D2 /* TableViewController.swift */,
9794
031A8D7D193DB57D00F4A6D2 /* Images.xcassets */,
@@ -227,7 +224,6 @@
227224
031A8D79193DB57D00F4A6D2 /* ViewController.swift in Sources */,
228225
031A8D94193DCBE900F4A6D2 /* TableViewController.swift in Sources */,
229226
031A8D77193DB57D00F4A6D2 /* AppDelegate.swift in Sources */,
230-
0356839119498B730039E42D /* MapViewController.swift in Sources */,
231227
031A8D9A193DDD4100F4A6D2 /* WebViewController.swift in Sources */,
232228
03B0EEB119595EF00048D16D /* CameraViewController.swift in Sources */,
233229
);

SwiftExample/Base.lproj/Main.storyboard

Lines changed: 4 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,6 @@
44
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6153.11"/>
55
</dependencies>
66
<scenes>
7-
<!--Map View Controller-->
8-
<scene sceneID="xas-nq-X9e">
9-
<objects>
10-
<viewController id="V4A-WZ-Px4" customClass="MapViewController" customModule="SwiftExample" customModuleProvider="target" sceneMemberID="viewController">
11-
<layoutGuides>
12-
<viewControllerLayoutGuide type="top" id="Jfo-Dq-cln"/>
13-
<viewControllerLayoutGuide type="bottom" id="reh-24-xxW"/>
14-
</layoutGuides>
15-
<view key="view" contentMode="scaleToFill" id="xF2-Ed-SWk">
16-
<rect key="frame" x="0.0" y="0.0" width="320" height="480"/>
17-
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
18-
<subviews>
19-
<mapView appearanceType="aqua" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="scaleToFill" fixedFrame="YES" mapType="standard" translatesAutoresizingMaskIntoConstraints="NO" id="Spk-vP-fSU">
20-
<rect key="frame" x="0.0" y="65" width="320" height="415"/>
21-
</mapView>
22-
</subviews>
23-
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
24-
</view>
25-
<navigationItem key="navigationItem" id="rvj-dW-8z1"/>
26-
<connections>
27-
<outlet property="mapView" destination="Spk-vP-fSU" id="gDX-Os-Fdu"/>
28-
</connections>
29-
</viewController>
30-
<placeholder placeholderIdentifier="IBFirstResponder" id="o1p-uV-389" userLabel="First Responder" sceneMemberID="firstResponder"/>
31-
</objects>
32-
<point key="canvasLocation" x="1048" y="-327"/>
33-
</scene>
347
<!--Camera View Controller - Camera-->
358
<scene sceneID="wfB-db-emn">
369
<objects>
@@ -80,7 +53,7 @@
8053
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
8154
<subviews>
8255
<button appearanceType="aqua" opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="pRd-1W-njR">
83-
<rect key="frame" x="187" y="158" width="106" height="30"/>
56+
<rect key="frame" x="107" y="151" width="106" height="30"/>
8457
<state key="normal" title="View table view">
8558
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
8659
</state>
@@ -89,25 +62,16 @@
8962
</connections>
9063
</button>
9164
<button appearanceType="aqua" opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="Vam-Mi-Rqo">
92-
<rect key="frame" x="207" y="317" width="66" height="30"/>
65+
<rect key="frame" x="127" y="237" width="66" height="30"/>
9366
<state key="normal" title="View web">
9467
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
9568
</state>
9669
<connections>
9770
<segue destination="wf8-3g-qWu" kind="push" id="WfQ-Sr-6bb"/>
9871
</connections>
9972
</button>
100-
<button appearanceType="aqua" opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="McD-sx-ZBW">
101-
<rect key="frame" x="217" y="238" width="67" height="30"/>
102-
<state key="normal" title="View map">
103-
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
104-
</state>
105-
<connections>
106-
<segue destination="V4A-WZ-Px4" kind="push" id="6Gm-bN-Br1"/>
107-
</connections>
108-
</button>
10973
<button appearanceType="aqua" opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="7MT-jK-mMs">
110-
<rect key="frame" x="196" y="373" width="88" height="30"/>
74+
<rect key="frame" x="116" y="309" width="88" height="30"/>
11175
<state key="normal" title="View camera">
11276
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
11377
</state>
@@ -145,7 +109,7 @@
145109
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
146110
</view>
147111
<connections>
148-
<outlet property="webView" destination="K28-0f-qxu" id="5wY-Vy-9Ts"/>
112+
<outlet property="webView" destination="K28-0f-qxu" id="gp3-Ij-mYl"/>
149113
</connections>
150114
</viewController>
151115
<placeholder placeholderIdentifier="IBFirstResponder" id="U1o-2E-873" userLabel="First Responder" sceneMemberID="firstResponder"/>

SwiftExample/TableViewController.swift

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ import UIKit
1111
class TableViewController: UITableViewController {
1212

1313
var tableArray:NSMutableArray = ["Swift", "Objective -C", "Python", "Java", "Ruby"]
14+
var snapshot:UIView = UIView()
15+
var sourceIndexPath:NSIndexPath = NSIndexPath()
1416

1517
init(style: UITableViewStyle) {
1618
super.init(style: style)
@@ -25,13 +27,66 @@ class TableViewController: UITableViewController {
2527
super.viewDidLoad()
2628

2729
self.title = "Table View"
30+
2831
}
2932

3033
override func didReceiveMemoryWarning() {
3134
super.didReceiveMemoryWarning()
3235
// Dispose of any resources that can be recreated.
3336
}
3437

38+
/*@IBAction func longPressRecognized(sender:AnyObject){
39+
40+
var longGesture:UILongPressGestureRecognizer = sender as UILongPressGestureRecognizer
41+
var gestureState:UIGestureRecognizerState = longGesture.state
42+
43+
var point:CGPoint = longGesture.locationInView(self.tableView)
44+
var indexPath:NSIndexPath = self.tableView.indexPathForRowAtPoint(point)
45+
46+
switch(gestureState){
47+
48+
case UIGestureRecognizerState.Began:
49+
{
50+
51+
if(indexPath)
52+
{
53+
sourceIndexPath = indexPath
54+
var cell:UITableViewCell = self.tableView.cellForRowAtIndexPath(indexPath)
55+
snapshot = self.customSnapshotFromView(cell)
56+
57+
var center:CGPoint = cell.center
58+
snapshot.center = center
59+
snapshot.alpha = 0.0
60+
self.tableView.addSubview(snapshot)
61+
UIView.animateWithDuration(0.25, animations: {(
62+
63+
center.y = point.y,
64+
snapshot.center = center,
65+
snapshot.transform = CGAffineTransformMakeScale(1.05, 1.05),
66+
snapshot.alpha = 0.98,
67+
68+
cell.backgroundColor = UIColor.blackColor()
69+
70+
)})
71+
}
72+
}
73+
break
74+
75+
}
76+
77+
func customSnapshotFromView(inputView:UIView) -> UIView
78+
{
79+
var snapshot:UIView = inputView.snapshotViewAfterScreenUpdates(true)
80+
snapshot.layer.masksToBounds = false
81+
snapshot.layer.cornerRadius = 0.0
82+
snapshot.layer.shadowOffset = CGSizeMake(-5.0, 0.0)
83+
snapshot.layer.shadowRadius = 5.0
84+
snapshot.layer.shadowOpacity = 0.4
85+
86+
return snapshot
87+
}
88+
89+
*/
3590
//#pragma mark - Table view data source
3691

3792
override func numberOfSectionsInTableView(tableView: UITableView?) -> Int {
@@ -72,6 +127,30 @@ class TableViewController: UITableViewController {
72127
{
73128
self.showAlert(tableArray.objectAtIndex(indexPath.row) as NSString, rowToUseInAlert: indexPath.row)
74129
}
130+
131+
override func tableView(tableView: UITableView!, canMoveRowAtIndexPath indexPath: NSIndexPath!) -> Bool
132+
{
133+
if(indexPath.row == 0)
134+
{
135+
return false
136+
}
137+
else
138+
{
139+
return true
140+
}
141+
}
142+
143+
override func tableView(tableView: UITableView!, moveRowAtIndexPath sourceIndexPath: NSIndexPath!, toIndexPath destinationIndexPath: NSIndexPath!)
144+
{
145+
var stringToMove:NSString = self.tableArray.objectAtIndex(sourceIndexPath.row) as NSString
146+
self.tableArray.removeObjectAtIndex(sourceIndexPath.row)
147+
self.tableArray.insertObject(stringToMove, atIndex: sourceIndexPath.row)
148+
}
149+
150+
override func tableView(tableView: UITableView!, targetIndexPathForMoveFromRowAtIndexPath sourceIndexPath: NSIndexPath!, toProposedIndexPath proposedDestinationIndexPath: NSIndexPath!) -> NSIndexPath!
151+
{
152+
return proposedDestinationIndexPath
153+
}
75154

76155
//#pragma mark - UIAlertView delegate methods
77156

0 commit comments

Comments
 (0)