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

来源:互联网 发布:java 网络拓扑图开发 编辑:程序博客网 时间:2024/04/30 07:14

这种方法在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];