-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfigurationViewController.m
More file actions
91 lines (71 loc) · 2.67 KB
/
ConfigurationViewController.m
File metadata and controls
91 lines (71 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
//
// ConfigurationViewController.m
// Rendezvous
//
// Created by Cauê Silva on 03/03/15.
// Copyright (c) 2015 Eduardo Quadros. All rights reserved.
//
#import "ConfigurationViewController.h"
@interface ConfigurationViewController ()
@end
@implementation ConfigurationViewController
- (void)viewDidLoad {
// Shows message when the user refuses to allow app permissions.
[super viewDidLoad];
_camera = [MKMapCamera camera];
_locationManager = [[CLLocationManager alloc] init];
[_locationManager requestAlwaysAuthorization];
[_locationManager setDelegate:self];
// Coordinates
[_locationManager setActivityType:CLActivityTypeFitness];
[_locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
[_locationManager setDistanceFilter:kCLHeadingFilterNone];
[_locationManager startUpdatingLocation];
// Orientation
[_locationManager setHeadingFilter:kCLHeadingFilterNone];
[_locationManager startUpdatingHeading];
// Map Options
[_mapView setDelegate:self];
[_mapView setZoomEnabled:NO]; // Disable Zoom
[_mapView setScrollEnabled:NO]; // Disable scrolling.
[_mapView setUserInteractionEnabled:NO]; // Disable User Interaction
[_mapView setRotateEnabled:YES]; // Enable map rotation.
[_mapView setShowsUserLocation:YES]; // Show user on map
}
/*
-(BOOL) prefersStatusBarHidden {
return YES;
}
*/
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
}
#pragma mark Updating Coordinates
- (void)locationManager:(CLLocationManager *)manager didUpdateLocations:(NSArray *)locations {
CLLocationCoordinate2D loc = [[locations lastObject] coordinate];
MKCoordinateRegion region = MKCoordinateRegionMakeWithDistance(loc, 80, 80);
[_camera setCenterCoordinate:loc];
[_camera setAltitude:100];
// [_mapView setRegion:region animated:YES];
[_mapView setCamera:_camera animated:YES];
}
#pragma mark Updating Direction
- (BOOL)locationManagerShouldDisplayHeadingCalibration:(CLLocationManager *)manager {
return YES;
}
- (void)locationManager:(CLLocationManager *)manager didUpdateHeading:(CLHeading *)newHeading {
if (newHeading.headingAccuracy > 0) {
[_camera setHeading:newHeading.trueHeading];
} else {
[_camera setHeading:newHeading.magneticHeading];
}
}
/*
#pragma mark - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
// Get the new view controller using [segue destinationViewController].
// Pass the selected object to the new view controller.
}
*/
@end