Map地图

作者: 9c3718310668 | 来源:发表于2018-11-23 11:33 被阅读0次

#import "ViewController.h"

#import <MapKit/MapKit.h>

@interface ViewController ()<MKMapViewDelegate,CLLocationManagerDelegate>

@property(nonatomic,strong)MKMapView *mapView;

@end

@implementation ViewController

- (void)viewDidLoad {

    [super viewDidLoad];

    _mapView = [[MKMapView alloc] initWithFrame:self.view.frame];

    // 设置地图显示n风格

    [_mapView setMapType:MKMapTypeStandard];

    // 设置缩放

    [_mapView setZoomEnabled:YES];

    // 设置滑动

    [_mapView setScrollEnabled:YES];

    // 设置旋转

    [_mapView setRotateEnabled:YES];

    // 显示m当前位置

    [_mapView setShowsUserLocation:YES];

    _mapView.delegate =self;

    [self jingdu:40.045612 weidu:116.30612];

    [self.view addSubview:_mapView];

}

-(void)jingdu:(CLLocationDegrees)j weidu:(CLLocationDegrees)w

{

    CLLocationCoordinate2D center = CLLocationCoordinate2DMake(j, w);

    MKCoordinateSpan span =MKCoordinateSpanMake(0.1, 0.1);

    MKCoordinateRegion regs= MKCoordinateRegionMake(center, span);

    [self.mapView setRegion:regs animated:YES];

}

@end

UITableView *tbv;

    UIScrollView *scro;

    UIPageControl *pag;

    NSTimer*timer;

    intk;

// 初始化滚动式图

        scro= [[UIScrollViewalloc]initWithFrame:CGRectMake(0,50,self.view.frame.size.width,200)];

        // 设置滚动范围

        scro.contentSize = CGSizeMake(3 * self.view.frame.size.width, 0);

        // 禁用弹簧效果

        scro.bounces=NO;

        // 禁用水平滚动

        scro.showsHorizontalScrollIndicator = NO;

        // 设置整页滚动

        scro.pagingEnabled = YES;

        // 设置代理

        scro.delegate=self;

        // 设置滚动图片

        for(inti =0; i <3; i++){

            // 设置图片数组

            NSArray*arr =@[@"1",@"2",@"3"];

            UIImageView*imgV = [[UIImageViewalloc]initWithFrame:CGRectMake(i *self.view.frame.size.width,0,self.view.frame.size.width,200)];

            // 加载图片

            imgV.image= [UIImageimageNamed:arr[i]];

            // 添加到滚动视图中

            [scroaddSubview:imgV];

        }

        // 添加到cell中

        [celladdSubview:scro];

        // 设置豆豆

        pag = [[UIPageControl alloc]initWithFrame:CGRectMake(90, 95, 150, 25)];

        // 设置豆豆的数量

        pag.numberOfPages = 3;

        // 设置豆豆的颜色

        pag.currentPageIndicatorTintColor = [UIColor orangeColor];

        pag.pageIndicatorTintColor = [UIColor whiteColor];

        // 添加到单元格中

        [celladdSubview:pag];

        // 创建定时器

        timer = [NSTimer scheduledTimerWithTimeInterval:1.0 target:self selector:@selector(aaa) userInfo:nil repeats:YES];

    returncell;

}

// 滚动视图

- (void)scrollViewDidScroll:(UIScrollView*)scrollView{

    // NSLog(@"%lf",scro.contentOffset.x);

    pag.currentPage = scro.contentOffset.x/self.view.frame.size.width;

}

// 定时器

-(void)aaa{

    [scro setContentOffset:CGPointMake(k * self.view.frame.size.width, 0)];

    k++;

    if(k>2){

        k=0;

    }

}

相关文章

  • zabbixApi4j-Map

    Map map.create: 创建新地图map.delete: 删除地图map.exists: 检查地图是否存在...

  • 4种常见用户体验地图速览

    摘要:移情地图(Empathy map),客户旅程地图(customer journey map),体验地图(ex...

  • 接入amap_map_fluttify 0.25.0 高德地图社

    amap_map_fluttify 0.25.0高德地图 地图组件 Flutter插件 第三方库 amap_map...

  • 高德地图 JS API 学习摘要2

    自定义地图 指定Map.mapStyle属性,实现自定义样式地图。 使用Map.setMapStyle()方法,加...

  • 微信小程序地图功能

    想要实现地图功能,首先先来说说显示地图 map,该组件是原生组件。map组件官方文档 第一步:显示地图 在对地图进...

  • uni-app map地图组件应用

    map地图组件使用时直接在template中使用标签,标签中可嵌套map属性 map最常用到...

  • 地图Map

    - (void)viewDidLoad { [super viewDidLoad]; /**创建地图*/ ...

  • Map地图

    MapKit:用于地图展示 CoreLocation:用于地理定位 CoreLocation框架的使用 CLLoc...

  • Map地图

    #import "ViewController.h" #import @interface ViewControl...

  • 地图map

    在页面中引入地图 首先要注册百度地图的开发者账号然后开始创建密钥 新建一个index.html 然后引用百度地图A...

网友评论

      本文标题:Map地图

      本文链接:https://www.haomeiwen.com/subject/jjxjqqtx.html