我在 xcode 中尝试了一些东西,我将这段代码用于我的 MapView。
选择器没有已知的类方法
'setRegion:animated:'
我用 3 个 .h 和 .m 文件制作了三个视图控制器。
我的错误是什么?
.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