0
#import "MainViewController.h"
#import "MyFirstAnnotation.h"
@implementation MainViewController
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
}
- (IBAction)annosetzen:(id)sender{
CLLocationCoordinate2D coor;
coor.latitude = 54.3327162876622;
coor.longitude = 10.1518177986145;
MKCoordinateSpan span;
span.latitudeDelta = 0.01;
span.longitudeDelta = 0.01;
MKCoordinateRegion region;
region.center = coor;
region.span = span;
MyFirstAnnotation *anno = [[MyFirstAnnotation alloc]init];
[mapView addAnnotation:anno];
[mapView setRegion:region animated:TRUE];
//MKReverseGeocoder *revGeo = [[MKReverseGeocoder alloc] initWithCoordinate:coor];
//revGeo.delegate = self;
//[revGeo start];
}
具有獲得字符串接下來的.m從一個.M將字符串傳遞到另一個.M
#import "MyFirstAnnotation.h"
@implementation MyFirstAnnotation
- (CLLocationCoordinate2D)coordinate {
CLLocationCoordinate2D coor;
coor.latitude = 54.3327162876622;
coor.longitude = 10.1518177986145;
return coor;
}
- (NSString *)title {
return theTitle;
}
- (NSString *)subtitle {
return theSubTitle;
}
標題和theSubTitle是字符串,並且必須從MainViewController .M傳遞給在MyFirstAnnotation中使用.m
你有一個簡單的例子如何做到這一點?林真的長尋找這個簡單的步驟,但我dosnt找到答案:-(
請幫我
你可以從你的實現添加到父類或委託,然後引用呢? – 2011-03-27 19:23:28
可能的重複[如何將字符串從一個.m傳遞到另一個.m文件](http://stackoverflow.com/questions/5451172/how-to-pass-a-string-from-one-m-to -another-m文件)。如有必要,請編輯您的問題,而不是多次張貼基本相同的東西。 – Caleb 2011-03-27 19:34:43