如何将plist的地址更新为Mapview?
|
我按照下面的代码,输出可以打印到控制台,但是如何在MapView上更新?
- (void)viewDidLoad {
[super viewDidLoad];
/* We have our address */
NSString *oreillyAddress = @\"1005 Gravenstein Highway North, Sebastopol, CA 95472, USA\";
/* We will later insert the address and the format that we want our output in, into this API\'s URL */
NSString *geocodingURL = @\"http://maps.google.com/maps/geo?q=%@&output=%@\";
/* Insert the address and the output format into the URL */
NSString *finalURL = [NSString stringWithFormat:geocodingURL, oreillyAddress, GOOGLE_OUTPUT_FORMAT_CSV];
/* Now escape the URL using appropriate percentage marks */
finalURL = [finalURL stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
/* Create our URL */
NSURL *urlToCall = [NSURL URLWithString:finalURL];
/* And a request for the connection using the URL */
NSURLRequest *request = [NSURLRequest requestWithURL:urlToCall];
/* We will put all the connection\'s received data into this instance of the NSMutableData class */
NSMutableData *newMutableData = [[NSMutableData alloc] init];
self.connectionData = newMutableData;
[newMutableData release];
NSURLConnection *newConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self];
/* Create the connection and start the downloading of geocoding results */
self.myConnection = newConnection;
[newConnection release];
}
- (void) viewDidUnload{
[super viewDidUnload];
[self.myConnection cancel];
self.myConnection = nil;
self.connectionData = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:
(UIInterfaceOrientation)interfaceOrientation {
/* Support all orientations */
return YES;
}
- (void)dealloc {
[myConnection cancel];
[myConnection release];
[connectionData release];
[super dealloc];
}
@end
没有找到相关结果
已邀请:
1 个回复
草票
协议的类,并使用ѭ3storing方法添加一个实例,该实例存储您到
对象的位置。如果位置在地图的显示区域内,则地图视图对象将调用委托方法
以使该视图显示在该注释中。因此,您将必须通过采用“ 5”协议来成为代表。实现
方法以返回
实例或您自己的
子类。 如果该位置不在显示的区域内,则使用use9ѭ方法移动到该位置。