- (void)viewDidLoad
{
[super viewDidLoad];
map.delegate=self;
map.showsUserLocation=YES;
[self show];
[self annonation];
alertInfoArray=[[NSArray alloc]init];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(void)show{
longatt=[[NSArray alloc]initWithObjects:[NSNumber numberWithFloat:72.87766],[NSNumber numberWithDouble:77.22496],[NSNumber numberWithDouble:78.70467],[NSNumber numberWithDouble:76.27108],[NSNumber numberWithDouble:77.594563], nil];
lat=[[NSArray alloc]initWithObjects:[NSNumber numberWithFloat:19.07598],[NSNumber numberWithFloat:28.63531],[NSNumber numberWithFloat:10.79048],[NSNumber numberWithFloat:10.85052],[NSNumber numberWithFloat:12.971599], nil];
title1=[[NSArray alloc]initWithObjects:@"Mumbai",@"Delhi",@"Trichy",@"kerala",@"Bangalore", nil];
for (int i=0; i<[longatt count]; i++)
{
CLLocationCoordinate2D center;
center.latitude=[[lat objectAtIndex:i]floatValue];
center.longitude=[[longatt objectAtIndex:i]floatValue];
MKCoordinateRegion reg;
reg.center=center;
[map setRegion:reg];
}
}
-(void)annonation{
for(int i=0;i<4;i++){
CLLocationCoordinate2D newcenter;
newcenter.latitude=[[lat objectAtIndex:i] floatValue];
newcenter.longitude=[[longatt objectAtIndex:i]floatValue] ;
MKPointAnnotation *pin=[[MKPointAnnotation alloc ]init];
//[pin setCoordinate:newcenter];
pin.coordinate=newcenter;
pin.title=[title1 objectAtIndex:i];
[map addAnnotation:pin];
}
}
No comments:
Post a Comment