zoukankan      html  css  js  c++  java
  • 百度地图添加大头针和视图

    首先初始化一个要展示的泡泡视图

     
        paopaoView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 200, 80)];
        paopaoView.layer.cornerRadius = 10;
        paopaoView.layer.borderColor = [UIColor lightGrayColor].CGColor;
        paopaoView.layer.borderWidth = 2;
        UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(20, 0, 160, 80)];
        label.numberOfLines = 0;
        label.text = @"上地三街36号 吃6块钱的麻辣烫上地三街36号 吃6块钱的麻辣烫上地三街36号 吃6块钱的麻辣烫";
        label.textColor = [UIColor redColor];
        label.font = [UIFont systemFontOfSize:13];
        [paopaoView addSubview:label];

    设置坐标点处的annotation

    -(void)viewDidAppear:(BOOL)animated{
     
        BMKPointAnnotation *annotation = [[BMKPointAnnotation alloc] init];
        CLLocationCoordinate2D coor;
        coor.latitude = 40.0424920000;
        coor.longitude = 116.3182870000;
        annotation.coordinate = coor;
        [_mapView addAnnotation:annotation];
    }

    代理方法实现

    -(BMKAnnotationView *)mapView:(BMKMapView *)mapView viewForAnnotation:(id<BMKAnnotation>)annotation{
     
        if([annotation isKindOfClass:[BMKPointAnnotation class]]){
            BMKPinAnnotationView *newAnnotationView = [[BMKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"myAnnotation"];
    //        newAnnotationView.animatesDrop = YES;
            newAnnotationView.annotation=annotation;
             //大头针图片
            newAnnotationView.image = [UIImage imageNamed:@"1.jpg"];
            newAnnotationView.paopaoView = [[BMKActionPaopaoView alloc]initWithCustomView:paopaoView];
            [newAnnotationView setSelected:YES animated:YES];
            return newAnnotationView;
        }
        return nil;
    }
  • 相关阅读:
    StringUtils
    改变windows锁屏时间
    data-toggle和data-target
    Bootstrap元素居中
    爬虫软件/程序
    nfs服务器搭建
    浏览器控制台console对象的使用
    F7
    Ubuntu18.04 安装Docker【转】
    mysql出现ERROR1698(28000):Access denied for user root@localhost错误解决方法【转】
  • 原文地址:https://www.cnblogs.com/machealking/p/4644599.html
Copyright © 2011-2022 走看看