I tried some things in xcode and I use this code for my MapView.
There is no known class method for selector 'setRegion:animated:'
'setRegion:animated:'
I created three View Controllers with three .h and .m files.
What is my mistake?
.m
#import "myPlacesAllTime.h" #import <MapKit/MapKit.h> @interface myPlacesAllTime () @end @implementation myPlacesAllTime - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } - (void)viewDidLoad { [super viewDidLoad]; MKCoordinateRegion startRegion = { {0.0,0.0}, {0.0,0.0} }; startRegion.center.latitude = 35.88905; startRegion.center .longitude = -17.605591; startRegion.span.latitudeDelta = 0.1; startRegion.span.longitudeDelta = 0.1; [myPlacesAllTime setRegion:startRegion animated: NO]; }
.h
#import <UIKit/UIKit.h> #import <MapKit/MapKit.h> @interface myPlacesAllTime : UIViewController <MKMapViewDelegate>{ __weak IBOutlet MKMapView *myPlacesAllTime; } @end
You have chosen the same name myPlacesAllTimefor the class and for the instance variable of this class.
myPlacesAllTime
To solve the problem, rename the class, for example. to MyPlacesControlleror similar. Note that convention should allow class names to start with a capital letter.
MyPlacesController
, . , MKMapView. ,
[self.myPlacesAllTime setRegion:startRegion animated:NO];
, . , , .
setRegion:animated: , , :
setRegion:animated:
+ (void)setRegion:(OBJ_Type)iType animated:(OBJ_Type)iAnimated {
- (void)setRegion:(OBJ_Type)iType animated:(OBJ_Type)iAnimated {
:
[self setRegion:PARAM animated:PARAM];