|
@@ -42,12 +42,25 @@ static CGImageRef _markerBlue = nil; |
|
@@ -42,12 +42,25 @@ static CGImageRef _markerBlue = nil; |
42
|
@synthesize location;
|
42
|
@synthesize location;
|
43
|
@synthesize data;
|
43
|
@synthesize data;
|
44
|
@synthesize labelView;
|
44
|
@synthesize labelView;
|
|
|
45
|
+@synthesize textForegroundColor;
|
|
|
46
|
+@synthesize textBackgroundColor;
|
45
|
|
47
|
|
46
|
+ (RMMarker*) markerWithNamedStyle: (NSString*) styleName
|
48
|
+ (RMMarker*) markerWithNamedStyle: (NSString*) styleName
|
47
|
{
|
49
|
{
|
48
|
return [[[RMMarker alloc] initWithNamedStyle: styleName] autorelease];
|
50
|
return [[[RMMarker alloc] initWithNamedStyle: styleName] autorelease];
|
49
|
}
|
51
|
}
|
50
|
|
52
|
|
|
|
53
|
+// init
|
|
|
54
|
+- (id)init
|
|
|
55
|
+{
|
|
|
56
|
+ if (self = [super init]) {
|
|
|
57
|
+ labelView = nil;
|
|
|
58
|
+ textForegroundColor = [UIColor blackColor];
|
|
|
59
|
+ textBackgroundColor = [UIColor clearColor];
|
|
|
60
|
+ }
|
|
|
61
|
+ return self;
|
|
|
62
|
+}
|
|
|
63
|
+
|
51
|
- (id) initWithCGImage: (CGImageRef) image
|
64
|
- (id) initWithCGImage: (CGImageRef) image
|
52
|
{
|
65
|
{
|
53
|
return [self initWithCGImage: image anchorPoint: CGPointMake(0.5, 1.0)];
|
66
|
return [self initWithCGImage: image anchorPoint: CGPointMake(0.5, 1.0)];
|
|
@@ -55,7 +68,7 @@ static CGImageRef _markerBlue = nil; |
|
@@ -55,7 +68,7 @@ static CGImageRef _markerBlue = nil; |
55
|
|
68
|
|
56
|
- (id) initWithCGImage: (CGImageRef) image anchorPoint: (CGPoint) _anchorPoint
|
69
|
- (id) initWithCGImage: (CGImageRef) image anchorPoint: (CGPoint) _anchorPoint
|
57
|
{
|
70
|
{
|
58
|
- if (![super init])
|
71
|
+ if (![self init])
|
59
|
return nil;
|
72
|
return nil;
|
60
|
|
73
|
|
61
|
self.contents = (id)image;
|
74
|
self.contents = (id)image;
|
|
@@ -131,17 +144,19 @@ static CGImageRef _markerBlue = nil; |
|
@@ -131,17 +144,19 @@ static CGImageRef _markerBlue = nil; |
131
|
- (void) setTextLabel: (NSString*)text
|
144
|
- (void) setTextLabel: (NSString*)text
|
132
|
{
|
145
|
{
|
133
|
CGPoint position = CGPointMake([self bounds].size.width / 2 - [text sizeWithFont:[UIFont systemFontOfSize:15]].width / 2, 4);
|
146
|
CGPoint position = CGPointMake([self bounds].size.width / 2 - [text sizeWithFont:[UIFont systemFontOfSize:15]].width / 2, 4);
|
134
|
- [self setTextLabel:text toPosition:position withFont:[UIFont systemFontOfSize:15] withTextColor:[UIColor blackColor] withBackgroundColor:[UIColor clearColor]];
|
147
|
+ [self setTextLabel:text toPosition:position withFont:[UIFont systemFontOfSize:15] withTextColor:[self textForegroundColor] withBackgroundColor:[self textBackgroundColor]];
|
135
|
}
|
148
|
}
|
136
|
|
149
|
|
137
|
- (void) setTextLabel: (NSString*)text toPosition:(CGPoint)position
|
150
|
- (void) setTextLabel: (NSString*)text toPosition:(CGPoint)position
|
138
|
{
|
151
|
{
|
139
|
- [self setTextLabel:text toPosition:position withFont:[UIFont systemFontOfSize:15] withTextColor:[UIColor blackColor] withBackgroundColor:[UIColor clearColor]];
|
152
|
+ [self setTextLabel:text toPosition:position withFont:[UIFont systemFontOfSize:15] withTextColor:[self textForegroundColor] withBackgroundColor:[self textBackgroundColor]];
|
140
|
}
|
153
|
}
|
141
|
|
154
|
|
142
|
- (void) setTextLabel: (NSString*)text withFont:(UIFont*)font withTextColor:(UIColor*)textColor withBackgroundColor:(UIColor*)backgroundColor
|
155
|
- (void) setTextLabel: (NSString*)text withFont:(UIFont*)font withTextColor:(UIColor*)textColor withBackgroundColor:(UIColor*)backgroundColor
|
143
|
{
|
156
|
{
|
144
|
CGPoint position = CGPointMake([self bounds].size.width / 2 - [text sizeWithFont:font].width / 2, 4);
|
157
|
CGPoint position = CGPointMake([self bounds].size.width / 2 - [text sizeWithFont:font].width / 2, 4);
|
|
|
158
|
+ [self setTextForegroundColor:textColor];
|
|
|
159
|
+ [self setTextBackgroundColor:backgroundColor];
|
145
|
[self setTextLabel:text toPosition:position withFont:font withTextColor:textColor withBackgroundColor:backgroundColor];
|
160
|
[self setTextLabel:text toPosition:position withFont:font withTextColor:textColor withBackgroundColor:backgroundColor];
|
146
|
}
|
161
|
}
|
147
|
|
162
|
|
|
@@ -154,6 +169,8 @@ static CGImageRef _markerBlue = nil; |
|
@@ -154,6 +169,8 @@ static CGImageRef _markerBlue = nil; |
154
|
textSize.height+4);
|
169
|
textSize.height+4);
|
155
|
|
170
|
|
156
|
UILabel *aLabel = [[UILabel alloc] initWithFrame:frame];
|
171
|
UILabel *aLabel = [[UILabel alloc] initWithFrame:frame];
|
|
|
172
|
+ [self setTextForegroundColor:textColor];
|
|
|
173
|
+ [self setTextBackgroundColor:backgroundColor];
|
157
|
[aLabel setNumberOfLines:0];
|
174
|
[aLabel setNumberOfLines:0];
|
158
|
[aLabel setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
|
175
|
[aLabel setAutoresizingMask:UIViewAutoresizingFlexibleWidth];
|
159
|
[aLabel setBackgroundColor:backgroundColor];
|
176
|
[aLabel setBackgroundColor:backgroundColor];
|
|
@@ -209,8 +226,10 @@ static CGImageRef _markerBlue = nil; |
|
@@ -209,8 +226,10 @@ static CGImageRef _markerBlue = nil; |
209
|
|
226
|
|
210
|
- (void) dealloc
|
227
|
- (void) dealloc
|
211
|
{
|
228
|
{
|
212
|
- self.labelView = nil;
|
|
|
213
|
- self.data = nil;
|
229
|
+ self.data = nil;
|
|
|
230
|
+ self.labelView = nil;
|
|
|
231
|
+ self.textForegroundColor = nil;
|
|
|
232
|
+ self.textBackgroundColor = nil;
|
214
|
[super dealloc];
|
233
|
[super dealloc];
|
215
|
}
|
234
|
}
|
216
|
|
235
|
|