|
|
@@ -69,11 +69,34 @@ static NSString* viewType = @"com.i2edu.mapView";
|
|
|
-(MAUserLocationRepresentation*)getRepresentation{
|
|
|
MAUserLocationRepresentation *r = [[MAUserLocationRepresentation alloc] init];
|
|
|
r.image=[UIImage imageNamed:@"dog"];
|
|
|
+ r.image=[self scaleToSize: r.image size:CGSizeMake(50, 60)];
|
|
|
// r.image=[UIImage imageWithContentsOfFile:@"Assets/Images/dog.png"];
|
|
|
// r.locationDotFillColor = [UIColor redColor];
|
|
|
return r;
|
|
|
|
|
|
}
|
|
|
+- (UIImage *)scaleToSize:(UIImage *)image size:(CGSize)size {
|
|
|
+ // 创建一个bitmap的context
|
|
|
+ // 并把它设置成为当前正在使用的context
|
|
|
+ // Determine whether the screen is retina
|
|
|
+ /*
|
|
|
+ if([[UIScreen mainScreen] scale] == 2.0) {
|
|
|
+ UIGraphicsBeginImageContextWithOptions(size, NO, 2.0);
|
|
|
+ } else {
|
|
|
+ UIGraphicsBeginImageContext(size);
|
|
|
+ }
|
|
|
+ */
|
|
|
+ UIGraphicsBeginImageContextWithOptions(size, NO, [[UIScreen mainScreen] scale]);
|
|
|
+ // 绘制改变大小的图片
|
|
|
+ [image drawInRect:CGRectMake(0, 0, size.width, size.height)];
|
|
|
+ // 从当前context中创建一个改变大小后的图片
|
|
|
+ UIImage * scaledImage = UIGraphicsGetImageFromCurrentImageContext();
|
|
|
+ // 使当前的context出堆栈
|
|
|
+ UIGraphicsEndImageContext();
|
|
|
+ // 返回新的改变大小后的图片
|
|
|
+ return scaledImage;
|
|
|
+}
|
|
|
+
|
|
|
|
|
|
- (UIView *)view{
|
|
|
return _mapView;
|
|
|
@@ -134,6 +157,7 @@ static NSString* viewType = @"com.i2edu.mapView";
|
|
|
annotationView.channel = self.channel;
|
|
|
|
|
|
annotationView.image = [UIImage imageNamed:@"i2"];
|
|
|
+ annotationView.image=[self scaleToSize: annotationView.image size:CGSizeMake(50, 60)];
|
|
|
// annotationView.pinColor = MAPinAnnotationColorPurple;
|
|
|
annotationView.canShowCallout= NO; //设置气泡可以弹出,默认为NO
|
|
|
// annotationView.animatesDrop = YES; //设置标注动画显示,默认为NO
|