'mapView위에'에 해당되는 글 1건

  1. 2010.09.11 mapView위에 컨트롤을 올리는 간단한 방법
아이폰어플개발정보2010. 9. 11. 09:25
mapView위에 컨트롤을 올리는 간단한 방법

간단하다. 그냥 mapView아래에 두면된다.
쏘스상에서 신경안써도된다.

self.isPlaying=NO;

upCount=0;

downCount=0;

backwardCount=0;

forwardCount=0;

    // register for keyboard notifications

//[super viewDidLoad];

//self.frontView = [[UIView alloc]init];

//[self.view addSubview:self.frontView];

//mapView=[[MKMapView alloc]initWithFrame:CGRectMake(0, 0, 320, 320)];

mapView.showsUserLocation=TRUE;

mapView.mapType=MKMapTypeStandard;

mapView.delegate=self;

MKCoordinateRegion region;

MKCoordinateSpan span;

span.latitudeDelta=0.012;

span.longitudeDelta=0.012;

locationManager=[[CLLocationManageralloc] init];

locationManager.delegate=self;

locationManager.desiredAccuracy=kCLLocationAccuracyNearestTenMeters;

[locationManagerstartUpdatingLocation];   //Activate this line for having GPS tracking working

CLLocationCoordinate2D location2; //= mapView.userLocation.coordinate;

location2.latitude=45.43717;

location2.longitude=12.32688;

//location2.latitude=self.startLatitude;

//location2.longitude=self.startLongitude;

//self.label_curLon.text=[NSNumber  numberWithDouble:[self startLatitude]];

//self.label_curLat.text=[NSNumber numberWithDouble:[self startLatitude]];

//self.label_curLon.text=[[NSString alloc] initWithFormat:@"%d", [self startLatitude]];

//self.label_curLat.text=[[NSString alloc] initWithFormat:@"%d", [self startLongitude]];

region.span=span;

region.center=location2;

[mapViewsetRegion:region animated:NO];

//[mapView regionThatFits:region];

[self.frontViewinsertSubview:mapViewatIndex:0];

CLLocationCoordinate2D c;

NSString *latitude =  @"45.43700";

NSString *longitude = @"12.32516";

c.latitude = [latitude doubleValue];

c.longitude = [longitude doubleValue];

GPSAnnotation *annotation = [[GPSAnnotationalloc] initWithCoordinate:c];

annotation.currentPoint = [NSNumber numberWithInt:1];

annotation.mTitle=@"Point number 1";

[mapView addAnnotation:annotation];

[annotation release];

self.trace=[[NSMutableArrayalloc]init];

}

보다시피 viewDid, viewWillAppear에서 addSubView할 필요없다.


Posted by 오늘마감

댓글을 달아 주세요