XCode 4에서 "MapAnnotation"클래스를 호출 할 수 없습니다. MKMapView에 핀을 배치 할 수 있도록 코딩 작업을하고 있습니다. 나는 올바른 대의원을 수입했다고 생각한다.코드 핀 위치를 코드하려고 할 때 "MapAnnotation"을 호출 할 수 없습니다.
MapViewController.h
:#import <Foundation/Foundation.h>
#import <MapKit/MKAnnotation.h>
#import <MapKit/MapKit.h>
@interface MillersLocations : NSObject <MKAnnotation> {
CLLocationCoordinate2D coordinate;
NSString *title;
NSString *subtitle;
}
@property (nonatomic, assign) CLLocationCoordinate2D coordinate;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *subtitle;
@end
MillersLocations.m
#import "MillersLocations.h"
@implementation MillersLocations
@synthesize coordinate, title, subtitle;
-(void)dealloc{
[title dealloc];
[subtitle dealloc];
[super dealloc];
}
@end
그리고 여기지도보기 내보기 컨트롤러의
MillersLocations.h
을 : 여기있어 무엇#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
@interface MapViewController : UIViewController <MKMapViewDelegate> {
IBOutlet MKMapView *mapView;
}
@end
내가 권리 클래스 또는 무언가를 가져 오지 않은 경우
MapViewController.m (단지 세그먼트 내가 찾고 있어요)
#import "MapViewController.h"
#import "MillersLocations.h"
@implementation MapViewController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
}
return self;
}
//skipping forward
- (void)viewDidLoad
{
[super viewDidLoad];
MKCoordinateRegion store1;
store1.center.latitude = 36.8605679;
store1.center.longitude = -76.2866713;
store1.span.latitudeDelta = 0.1;
store1.span.longitudeDelta = 0.1;
[mapView setRegion:store1 animated:YES];
//this is where I'm trying to put this code in:
MapAnnotation* annotation = [[MapAnnotation alloc] initWithCoordinate:newCoord];
//BUT "MapAnnotation" isn't an option
}
가 궁금하네요. 내가 봤 거든 "MapAnnotation"거짓말을 찾을 수가 없어. "MapAnnotation"에 액세스하려면 무엇을 가져올 필요가 있습니까? 그 시점까지 모든 것이 잘 작동합니다.
도움 주셔서 감사합니다. 나는이 물건을 배우는 것 뿐이야!
오, 이런 ... 내 잘못. 답변 해주셔서 감사합니다! 내 뇌는 여전히 수퍼 스크램블을하고있다. 빠른 답변에 감사드립니다. – MillerMedia