|
@@ -24,6 +24,7 @@ typedef enum { |
|
@@ -24,6 +24,7 @@ typedef enum { |
24
|
@property (nonatomic, retain) UIActivityIndicatorView *activityView;
|
24
|
@property (nonatomic, retain) UIActivityIndicatorView *activityView;
|
25
|
@property (nonatomic, assign) RMUserTrackingButtonState state;
|
25
|
@property (nonatomic, assign) RMUserTrackingButtonState state;
|
26
|
|
26
|
|
|
|
27
|
+- (void)createBarButtonItem;
|
27
|
- (void)updateAppearance;
|
28
|
- (void)updateAppearance;
|
28
|
- (void)changeMode:(id)sender;
|
29
|
- (void)changeMode:(id)sender;
|
29
|
|
30
|
|
|
@@ -44,6 +45,26 @@ typedef enum { |
|
@@ -44,6 +45,26 @@ typedef enum { |
44
|
if ( ! (self = [super initWithCustomView:[[UIControl alloc] initWithFrame:CGRectMake(0, 0, 32, 32)]]))
|
45
|
if ( ! (self = [super initWithCustomView:[[UIControl alloc] initWithFrame:CGRectMake(0, 0, 32, 32)]]))
|
45
|
return nil;
|
46
|
return nil;
|
46
|
|
47
|
|
|
|
48
|
+ [self createBarButtonItem];
|
|
|
49
|
+ [self setMapView:mapView];
|
|
|
50
|
+
|
|
|
51
|
+ return self;
|
|
|
52
|
+}
|
|
|
53
|
+
|
|
|
54
|
+- (id)initWithCoder:(NSCoder *)aDecoder
|
|
|
55
|
+{
|
|
|
56
|
+ if ( ! (self = [super initWithCoder:aDecoder]))
|
|
|
57
|
+ return nil;
|
|
|
58
|
+
|
|
|
59
|
+ [self setCustomView:[[UIControl alloc] initWithFrame:CGRectMake(0, 0, 32, 32)]];
|
|
|
60
|
+
|
|
|
61
|
+ [self createBarButtonItem];
|
|
|
62
|
+
|
|
|
63
|
+ return self;
|
|
|
64
|
+}
|
|
|
65
|
+
|
|
|
66
|
+- (void)createBarButtonItem
|
|
|
67
|
+{
|
47
|
_segmentedControl = [[[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:@""]] retain];
|
68
|
_segmentedControl = [[[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:@""]] retain];
|
48
|
_segmentedControl.segmentedControlStyle = UISegmentedControlStyleBar;
|
69
|
_segmentedControl.segmentedControlStyle = UISegmentedControlStyleBar;
|
49
|
[_segmentedControl setWidth:32.0 forSegmentAtIndex:0];
|
70
|
[_segmentedControl setWidth:32.0 forSegmentAtIndex:0];
|
|
@@ -70,16 +91,7 @@ typedef enum { |
|
@@ -70,16 +91,7 @@ typedef enum { |
70
|
|
91
|
|
71
|
[((UIControl *)self.customView) addTarget:self action:@selector(changeMode:) forControlEvents:UIControlEventTouchUpInside];
|
92
|
[((UIControl *)self.customView) addTarget:self action:@selector(changeMode:) forControlEvents:UIControlEventTouchUpInside];
|
72
|
|
93
|
|
73
|
- _mapView = [mapView retain];
|
|
|
74
|
-
|
|
|
75
|
- [_mapView addObserver:self forKeyPath:@"userTrackingMode" options:NSKeyValueObservingOptionNew context:nil];
|
|
|
76
|
- [_mapView addObserver:self forKeyPath:@"userLocation.location" options:NSKeyValueObservingOptionNew context:nil];
|
|
|
77
|
-
|
|
|
78
|
_state = RMUserTrackingButtonStateLocation;
|
94
|
_state = RMUserTrackingButtonStateLocation;
|
79
|
-
|
|
|
80
|
- [self updateAppearance];
|
|
|
81
|
-
|
|
|
82
|
- return self;
|
|
|
83
|
}
|
95
|
}
|
84
|
|
96
|
|
85
|
- (void)dealloc
|
97
|
- (void)dealloc
|