【问题标题】:expression isn't not assign,mapkit表达式不是不赋值,mapkit
【发布时间】:2013-01-02 15:56:39
【问题描述】:

我正在尝试显示地图工具包,我正在执行以下操作: MapViewController.h

#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import <QuartzCore/QuartzCore.h>
@interface SiteViewController : UIViewController <MKMapViewDelegate>

@property (assign, nonatomic)       MKCoordinateRegion  region;
@property (strong, nonatomic)       IBOutlet MKMapView  *googleMap;

@end

MapViewController.m

- (void)viewDidLoad
{
    [super viewDidLoad];

    // Set propertiesfor the mapView
    self.region.center.latitude         =   43.62862 ; // expression is not assigned
    self.region.center.longitude        =   -79.331245;// expression is not assigned
    self.region.span.longitudeDelta     =   0.01f;     // expression is not assigned
    self.region.span.longitudeDelta     =   0.01f;     // expression is not assigned
    [self.googleMap setMapType:MKMapTypeStandard];
    [self.googleMap setZoomEnabled:YES];
    [self.googleMap setScrollEnabled:YES];
    [self.googleMap setRegion:self.region animated:YES];


    MKPointAnnotation *pin = [[MKPointAnnotation alloc] init];
    pin.coordinate  = region.center;
    [self.googleMap addAnnotation:pin];
}

我来了

表达式未赋值

我不明白。有人可以解释一下,让我摆脱这个麻烦。

【问题讨论】:

标签: objective-c ios6 mapkit mkcoordinateregion


【解决方案1】:

你需要通过region属性或者- (void)setRegion:(MKCoordinateRegion)region animated:(BOOL)animated;方法来设置mapview区域。

试试这个:

CLLocationCoordinate2D coordinate = CLLocationCoordinate2DMake(43.62862, -79.331245);

[self.mapView setRegion:MKCoordinateRegionMake(coordinate, MKCoordinateSpanMake(0.01f, 0.01f))];

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-01-10
    • 1970-01-01
    • 1970-01-01
    • 2017-05-23
    • 2019-12-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多