Browse Source

Pagina inicial con Tracking

Kendrick Morales 4 years ago
parent
commit
7533ab256f

+ 2
- 2
Trolley App.xcodeproj/project.pbxproj View File

@@ -294,7 +294,7 @@
294 294
 				PRODUCT_BUNDLE_IDENTIFIER = "com.uprrp.Trolley-App";
295 295
 				PRODUCT_NAME = "$(TARGET_NAME)";
296 296
 				SWIFT_VERSION = 5.0;
297
-				TARGETED_DEVICE_FAMILY = "1,2";
297
+				TARGETED_DEVICE_FAMILY = 1;
298 298
 			};
299 299
 			name = Debug;
300 300
 		};
@@ -312,7 +312,7 @@
312 312
 				PRODUCT_BUNDLE_IDENTIFIER = "com.uprrp.Trolley-App";
313 313
 				PRODUCT_NAME = "$(TARGET_NAME)";
314 314
 				SWIFT_VERSION = 5.0;
315
-				TARGETED_DEVICE_FAMILY = "1,2";
315
+				TARGETED_DEVICE_FAMILY = 1;
316 316
 			};
317 317
 			name = Release;
318 318
 		};

+ 23
- 0
Trolley App/Assets.xcassets/map.imageset/Contents.json View File

@@ -0,0 +1,23 @@
1
+{
2
+  "images" : [
3
+    {
4
+      "idiom" : "universal",
5
+      "filename" : "map.jpg",
6
+      "scale" : "1x"
7
+    },
8
+    {
9
+      "idiom" : "universal",
10
+      "filename" : "map@2x.jpg",
11
+      "scale" : "2x"
12
+    },
13
+    {
14
+      "idiom" : "universal",
15
+      "filename" : "map@3x.jpg",
16
+      "scale" : "3x"
17
+    }
18
+  ],
19
+  "info" : {
20
+    "version" : 1,
21
+    "author" : "xcode"
22
+  }
23
+}

BIN
Trolley App/Assets.xcassets/map.imageset/map.jpg View File


BIN
Trolley App/Assets.xcassets/map.imageset/map@2x.jpg View File


BIN
Trolley App/Assets.xcassets/map.imageset/map@3x.jpg View File


+ 47
- 5
Trolley App/Base.lproj/Main.storyboard View File

@@ -1,7 +1,8 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2
-<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="13122.16" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
2
+<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="15400" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
3
+    <device id="retina6_1" orientation="portrait" appearance="light"/>
3 4
     <dependencies>
4
-        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="13104.12"/>
5
+        <plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="15404"/>
5 6
         <capability name="Safe area layout guides" minToolsVersion="9.0"/>
6 7
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
7 8
     </dependencies>
@@ -9,16 +10,57 @@
9 10
         <!--View Controller-->
10 11
         <scene sceneID="tne-QT-ifu">
11 12
             <objects>
12
-                <viewController id="BYZ-38-t0r" customClass="ViewController" customModuleProvider="target" sceneMemberID="viewController">
13
+                <viewController id="BYZ-38-t0r" customClass="ViewController" customModule="Trolley_App" customModuleProvider="target" sceneMemberID="viewController">
13 14
                     <view key="view" contentMode="scaleToFill" id="8bC-Xf-vdC">
14
-                        <rect key="frame" x="0.0" y="0.0" width="375" height="667"/>
15
+                        <rect key="frame" x="0.0" y="0.0" width="414" height="896"/>
15 16
                         <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
16
-                        <color key="backgroundColor" xcode11CocoaTouchSystemColor="systemBackgroundColor" cocoaTouchSystemColor="whiteColor"/>
17
+                        <subviews>
18
+                            <label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" text="Trolley IUPI" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="5sx-mb-Vhu">
19
+                                <rect key="frame" x="108" y="90" width="201" height="47"/>
20
+                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
21
+                                <fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="40"/>
22
+                                <nil key="textColor"/>
23
+                                <nil key="highlightedColor"/>
24
+                            </label>
25
+                            <imageView clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleAspectFit" horizontalHuggingPriority="251" verticalHuggingPriority="251" fixedFrame="YES" image="map" translatesAutoresizingMaskIntoConstraints="NO" id="KQC-gY-9mQ">
26
+                                <rect key="frame" x="7" y="248" width="400" height="400"/>
27
+                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
28
+                            </imageView>
29
+                            <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="OCY-3M-KE5">
30
+                                <rect key="frame" x="71" y="706" width="111" height="47"/>
31
+                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
32
+                                <color key="backgroundColor" systemColor="systemPinkColor" red="1" green="0.1764705882" blue="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
33
+                                <fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="30"/>
34
+                                <state key="normal" title="Paradas">
35
+                                    <color key="titleColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
36
+                                </state>
37
+                                <connections>
38
+                                    <action selector="paradasButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="esp-QM-yT5"/>
39
+                                </connections>
40
+                            </button>
41
+                            <button opaque="NO" contentMode="scaleToFill" fixedFrame="YES" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="2cl-Ch-09v">
42
+                                <rect key="frame" x="246" y="706" width="113" height="47"/>
43
+                                <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
44
+                                <color key="backgroundColor" systemColor="systemPinkColor" red="1" green="0.1764705882" blue="0.33333333329999998" alpha="1" colorSpace="custom" customColorSpace="sRGB"/>
45
+                                <fontDescription key="fontDescription" name="HelveticaNeue" family="Helvetica Neue" pointSize="30"/>
46
+                                <state key="normal" title="Tracking">
47
+                                    <color key="titleColor" white="0.0" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
48
+                                </state>
49
+                                <connections>
50
+                                    <action selector="trackingButton:" destination="BYZ-38-t0r" eventType="touchUpInside" id="bj2-2c-F73"/>
51
+                                </connections>
52
+                            </button>
53
+                        </subviews>
54
+                        <color key="backgroundColor" systemColor="secondarySystemGroupedBackgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
17 55
                         <viewLayoutGuide key="safeArea" id="6Tk-OE-BBY"/>
18 56
                     </view>
19 57
                 </viewController>
20 58
                 <placeholder placeholderIdentifier="IBFirstResponder" id="dkx-z0-nzr" sceneMemberID="firstResponder"/>
21 59
             </objects>
60
+            <point key="canvasLocation" x="137.68115942028987" y="133.92857142857142"/>
22 61
         </scene>
23 62
     </scenes>
63
+    <resources>
64
+        <image name="map" width="520.5" height="431"/>
65
+    </resources>
24 66
 </document>

+ 4
- 2
Trolley App/Info.plist View File

@@ -20,6 +20,10 @@
20 20
 	<string>1</string>
21 21
 	<key>LSRequiresIPhoneOS</key>
22 22
 	<true/>
23
+	<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
24
+	<string>Se utilizara para su experiencia en la applicacion</string>
25
+	<key>NSLocationWhenInUseUsageDescription</key>
26
+	<string>Se utilizara para su experiencia en la applicacion</string>
23 27
 	<key>UIApplicationSceneManifest</key>
24 28
 	<dict>
25 29
 		<key>UIApplicationSupportsMultipleScenes</key>
@@ -50,8 +54,6 @@
50 54
 	<key>UISupportedInterfaceOrientations</key>
51 55
 	<array>
52 56
 		<string>UIInterfaceOrientationPortrait</string>
53
-		<string>UIInterfaceOrientationLandscapeLeft</string>
54
-		<string>UIInterfaceOrientationLandscapeRight</string>
55 57
 	</array>
56 58
 	<key>UISupportedInterfaceOrientations~ipad</key>
57 59
 	<array>

+ 44
- 4
Trolley App/ViewController.swift View File

@@ -7,14 +7,54 @@
7 7
 //
8 8
 
9 9
 import UIKit
10
+import CoreLocation
11
+import MapKit
12
+class ViewController: UIViewController,  CLLocationManagerDelegate {
10 13
 
11
-class ViewController: UIViewController {
12
-
14
+    var estado = false
15
+    let locationManager = CLLocationManager()
16
+    
17
+   
18
+    
19
+    
13 20
     override func viewDidLoad() {
14 21
         super.viewDidLoad()
22
+        locationManager.requestAlwaysAuthorization()
23
+        if CLLocationManager.locationServicesEnabled() {
24
+            locationManager.delegate = self
25
+            locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters
26
+        }
27
+
15 28
         // Do any additional setup after loading the view.
16 29
     }
17
-
18
-
30
+    
31
+    //funcion para poder extraer latitud y longitud
32
+    func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
33
+        guard let locValue: CLLocationCoordinate2D = manager.location?.coordinate
34
+            else { return }
35
+        print("locations = \(locValue.latitude) \(locValue.longitude)")
36
+    }
37
+ 
38
+    
39
+    //botton de las paradas
40
+    @IBAction func trackingButton(_ sender: UIButton) {
41
+        
42
+        // si el estado esta en falso
43
+        if estado != true{
44
+         sender.setTitle("Stop", for: .normal) // cambia el texto del boton
45
+         estado = true // cambiamos el estado a activado
46
+         locationManager.startUpdatingLocation() // activamos el metodo de capturacion de localizacion
47
+        }
48
+        else{ // si el estado esta en cierto
49
+             sender.setTitle("Tracking", for: .normal) // cambiamos el texto del boton
50
+            locationManager.stopUpdatingLocation() // paramos el metodo de capturacion de localizacion
51
+            
52
+            estado = false // se cambia estado de nuevo a falso
53
+        }
54
+    }
55
+    
56
+   
57
+    
58
+    
19 59
 }
20 60