BasicMapViewController.m 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. /*
  2. * Copyright 2016 Google Inc. All rights reserved.
  3. *
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
  6. * file except in compliance with the License. You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software distributed under
  11. * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
  12. * ANY KIND, either express or implied. See the License for the specific language governing
  13. * permissions and limitations under the License.
  14. */
  15. #import "GoogleMapsDemos/Samples/BasicMapViewController.h"
  16. #import <GoogleMaps/GoogleMaps.h>
  17. @interface BasicMapViewController () <GMSMapViewDelegate>
  18. @end
  19. @implementation BasicMapViewController {
  20. UILabel *_statusLabel;
  21. }
  22. - (void)viewDidLoad {
  23. [super viewDidLoad];
  24. GMSCameraPosition *camera = [GMSCameraPosition cameraWithLatitude:-33.868
  25. longitude:151.2086
  26. zoom:6];
  27. GMSMapView *view = [GMSMapView mapWithFrame:CGRectZero camera:camera];
  28. view.delegate = self;
  29. self.view = view;
  30. // Add status label, initially hidden.
  31. _statusLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 0, 30)];
  32. _statusLabel.alpha = 0.0f;
  33. _statusLabel.autoresizingMask = UIViewAutoresizingFlexibleWidth;
  34. _statusLabel.backgroundColor = [UIColor blueColor];
  35. _statusLabel.textColor = [UIColor whiteColor];
  36. _statusLabel.textAlignment = NSTextAlignmentCenter;
  37. [view addSubview:_statusLabel];
  38. }
  39. - (void)mapViewDidStartTileRendering:(GMSMapView *)mapView {
  40. _statusLabel.alpha = 0.8f;
  41. _statusLabel.text = @"Rendering";
  42. }
  43. - (void)mapViewDidFinishTileRendering:(GMSMapView *)mapView {
  44. _statusLabel.alpha = 0.0f;
  45. }
  46. @end