Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Draw This
($0.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 08-04-2009, 03:39 AM   #7 (permalink)
slackwar
Registered Member
 
Join Date: Jul 2009
Posts: 2
slackwar is on a distinguished road
Default Did it display annotation view without tapping pin ?

Quote:
Originally Posted by hemalimojidra View Post
It is posibale with

///////////////////////////////////////////////

CLLocation *myPlaceLocation = [[CLLocation alloc] initWithLatitude:23.7899 longitude:75.890];
MyPlaceMark *myPlaceMark = [[MyPlaceMark alloc] initWithCoordinate:[myPlaceLocation coordinate]];
[myPlaceMark setAnootationTitle:@"My Place Mark"];
[myPlaceMark setAnootationSubTitle:@"My Place Mark"];
[myMapView addAnnotation:myPlaceMark];
//myMapView is instance of MKMapView class
[myMapView setCenterCoordinate:myPlaceLocation.coordinate animated:YES];
[myMapView setSelectedAnnotations:[[NSArray alloc] initWithObjects:myPlaceMark,nil]];


//////////////////////////////////////

Thanks,
Hemali Mojidra
Virtueinfo, Ahmedabad
When I use this method, it doesn't display annotation view without tapping a pin. Am I missing something?

For your reference, here goes my sample code.
Code:
- (void)viewDidLoad {
    [super viewDidLoad];
	mapView = [[MKMapView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
	mapView.mapType = MKMapTypeStandard;
	mapView.delegate = self;
	[self.view addSubview:mapView];
	
	myPlaceLocation = [[CLLocation alloc] initWithLatitude:23.7899 longitude:75.890];
	myPlaceMark = [[MyLocation alloc] init];
	[myPlaceMark setCoordinate:[myPlaceLocation coordinate]];
	[myPlaceMark setTitle:@"My Place Mark"];
	[myPlaceMark setSubtitle:@"My Place Mark"];
	
	[mapView addAnnotation:myPlaceMark];
	//myMapView is instance of MKMapView class 
	[mapView setCenterCoordinate:myPlaceLocation.coordinate animated:YES];
	[mapView setSelectedAnnotations:[[NSArray alloc] initWithObjects:myPlaceMark,nil]];
}
Code:
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation
{
	MKPinAnnotationView *annView = [[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"sample"];
	
	annView.canShowCallout = YES;
	
	return annView;
}
slackwar is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 175,020
Threads: 93,863
Posts: 401,921
Top Poster: BrianSlick (7,962)
Welcome to our newest member, wendolynlm80
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 10:19 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.