您的位置:首页 > 编程语言

关于地图的操作的代码片段

2012-05-30 09:36 232 查看
这种方法在application bundle的顶层文件夹寻找由供应的名字的图象 。 如果找到图片,装载到iPhone系统缓存图象。那意味图片是(理论上)放在内存里作为cache的。

图片cache极有可能不会响应 memory warnings and release its objects:

用图片的时候一定要小心的alloc和release

推荐使用

NSString *path = [[NSBundle mainBundle] pathForResource:@"icon" ofType:@"png"];

myImage = [UIImage imageWithContentsOfFile:path];

---------------------1-地图------------------------
//(1)创建MKMapView
//CGRect rect = CGRectMake(0, 0, 320, 460);
// supportMapView = [[MKMapView alloc] initWithFrame:rect];
//设定经纬度
CLLocationCoordinate2D theCoordinate;
theCoordinate.latitude=22.53705;
theCoordinate.longitude=114.08248;
//设定显示范围
// MKCoordinateSpan theSpan;
// theSpan.latitudeDelta=0.08;
// theSpan.longitudeDelta=0.08;

// //设置地图显示的中心及范围
// MKCoordinateRegion theRegion;
// theRegion.center=theCoordinate;
// theRegion.span=theSpan;

// //设置地图显示
// [supportMapView setMapType:MKMapTypeStandard];
// //[supportMapView setRegion:theRegion];
// [supportMapView setRegion:theRegion animated:YES];
// [supportMapView regionThatFits:theRegion];
//
// //(2)地图加标注
// SupportAnnotation *mapAnnotations=[[SupportAnnotation alloc] initWithCoordinate:theCoordinate];
// mapAnnotations.title ;
// mapAnnotations.subtitle
// [supportMapView addAnnotation:mapAnnotations];
// [mapAnnotations release];
//
// //
// [zoomOutButton setHidden:FALSE];
// [zoonInButton setHidden:TRUE];
// [zoomOutView setHidden:TRUE];
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: