0

Iam trying to display a map kit and I am doing the following : 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];
}

I am getting

expression is not assigned

I dont get it. Can somebody get explain and get me out of this trouble.

tranvutuan
  • 6,089
  • 8
  • 47
  • 83
  • 1
    I think you'll find this similar question helpful: http://stackoverflow.com/questions/7074405/expression-is-not-assignable-problem-assigning-float-as-sum-of-two-other-fl – Firoze Lafeer Jan 18 '13 at 21:02

1 Answers1

0

You need to set the mapview region via the region property or the method - (void)setRegion:(MKCoordinateRegion)region animated:(BOOL)animated;.

Try this:

CLLocationCoordinate2D coordinate = CLLocationCoordinate2DMake(43.62862, -79.331245);

[self.mapView setRegion:MKCoordinateRegionMake(coordinate, MKCoordinateSpanMake(0.01f, 0.01f))];
Alex
  • 8,801
  • 5
  • 27
  • 31