【问题标题】:Is there any way to load Direct Map View ,hiding default North America loading?有没有办法加载直接地图视图,隐藏默认的北美加载?
【发布时间】:2012-11-19 08:12:47
【问题描述】:

我已经为一家商店制作了一个基于 GPS 位置的 Mapkit 应用程序,它在表格视图中有四个位置,当用户选择其中任何一个位置时,它会导航到 MapView 并加载所有内容,但我的问题是加载完成后它显示北美地图的加载时间我得到了所需的地图视图。我需要在加载时显示活动指示器或空白的灰色地图屏幕。

我正在以编程方式调用我的编码所在的地图视图

UIView *contentView = [[UIView alloc] initWithFrame:CGRectMake(0.0f, 0.0f, 320.0f, 372.0f)];
self.view = contentView;
[contentView release];

routeMapView = [[MKMapView alloc] initWithFrame:contentView.frame];
routeMapView.delegate = self;
routeMapView.showsUserLocation = YES;
[contentView addSubview:routeMapView];
[routeMapView release];

routeOverlayView = [[UICRouteOverlayMapView alloc] initWithMapView:routeMapView];
UIBarButtonItem *space = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil] autorelease];
UIBarButtonItem *currentLocationButton = [[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"reticle.png"] style:UIBarButtonItemStylePlain target:self action:@selector(moveToCurrentLocation:)] autorelease];
UIBarButtonItem *routesButton = [[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"list.png"] style:UIBarButtonItemStylePlain target:self action:@selector(showRouteListView:)] autorelease];
self.toolbarItems = [NSArray arrayWithObjects:currentLocationButton, space, /*mapPinButton,*/ routesButton, nil];
[self.navigationController setToolbarHidden:NO animated:NO];

【问题讨论】:

    标签: google-maps xcode4.2


    【解决方案1】:

    最后我找到了我的问题的解决方案, 首先像这样定义一个局部区域坐标

    MKCoordinateRegion region={{0.0,0.0},{0.0,0.0}};
    

    然后为对其所做的更改定义动画,

    [routeMapView setRegion:region animated:YES];
    

    然后

    activityIndicator =[[[UIActivityIndicatorView alloc]initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray]autorelease];
    activityIndicator.frame=CGRectMake(0.0, 0.0, 40.0, 40.0);
    activityIndicator.center=self.view.center;
    [self.view addSubview:activityIndicator];
    
    if([UIApplication sharedApplication].networkActivityIndicatorVisible=YES)
    {
    
        [activityIndicator startAnimating];
    
    }
    

    然后声明 [activityIndi​​cator stopAnimating];在所有操作结束的委托函数中。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-05-29
      • 2020-03-01
      • 1970-01-01
      • 2021-04-10
      • 2013-07-04
      • 1970-01-01
      • 2021-09-30
      相关资源
      最近更新 更多