UIView不显示我的地图,只显示标准地图

时间:2014-06-20 22:56:35

标签: ios objective-c google-maps-sdk-ios gmsmapview

这是我在UIView中实现的视图控制器。

编译器以黄色突出显示的行是:

self.vermapa_.delegate=self;

self出了什么问题?

(H)

#import <UIKit/UIKit.h>

@interface appiOSViewController : UIViewController

@end

和(.m)

#import "appiOSViewController.h"
#import <GoogleMaps/GoogleMaps.h>
@interface appiOSViewController ()
@property (weak,nonatomic) IBOutlet GMSMapView *vermapa_;
@end

@implementation appiOSViewController

- (void)viewDidLoad
{
    [super viewDidLoad];

    **self.vermapa_.delegate=self;**

    GMSCameraPosition *pos = [GMSCameraPosition cameraWithLatitude:7.114797
                                                         longitude:-73.104932
                                                              zoom:15.3];

    self.vermapa_ = [GMSMapView mapWithFrame:CGRectZero camera:pos];
    self.vermapa_.myLocationEnabled = YES;
    self.vermapa_.settings.compassButton = YES;
    self.vermapa_.settings.myLocationButton = YES;
    self.vermapa_.settings.zoomGestures = YES;


    GMSMarker *marker = [[GMSMarker alloc] init];
    marker.position = CLLocationCoordinate2DMake(7.116309,-73.105713);
    marker.title = @"Parada frente al edificio L";
    marker.snippet = @"UNAB - Jardín";
    marker.map = self.vermapa_;

    GMSMarker *marker1 = [[GMSMarker alloc] init];
    marker1.position = CLLocationCoordinate2DMake(7.112412,-73.105134);
    marker1.title = @"CSU";
    marker1.snippet = @"UNAB - Terrazas";
    marker1.map = self.vermapa_;

    GMSMarker *marker2 = [[GMSMarker alloc] init];
    marker2.position = CLLocationCoordinate2DMake(7.110863,-73.106075);
    marker2.title = @"Parada de Bus - Terrazas";
    marker2.snippet = @"Terrazas";
    marker2.map = self.vermapa_;

    GMSMarker *marker3 = [[GMSMarker alloc] init];
    marker3.position = CLLocationCoordinate2DMake(7.117738,-73.105651);
    marker3.title = @"Parqueadero UNAB";
    marker3.snippet = @"UNAB - Jardín";
    marker3.map = self.vermapa_;


    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

1 个答案:

答案 0 :(得分:0)

你应该这样做:

@interface appiOSViewController () <GMSMapViewDelegate>

如果您将成为某个对象的委托,您应该告诉该类您将实现委托方法。