Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @interface MyAnnotationPins : NSObject < MKAnnotation>
- @property (nonatomic, readonly) CLLocationCoordinate2D coordinate;
- @property (nonatomic, readonly, copy) NSString *title;
- @property (nonatomic, readonly, copy) NSString *subtitle;
- -(id)initWithCoordinate:(CLLocationCoordinate2D)annotCoordinate title:(NSString*)annotTitle subtitle:(NSString*)annotSubtitle;
- @synthesize coordinate;
- @synthesize subtitle;
- @synthesize title;
- -(id)initWithCoordinate:(CLLocationCoordinate2D)annotCoordinate title:(NSString*)annotTitle subtitle:(NSString*)annotSubtitle
- {
- self = [super init];
- if (self)
- {
- coordinate = annotCoordinate;
- subtitle = [[NSString alloc] initWithString:annotSubtitle];
- title = [[NSString alloc] initWithString:annotTitle];
- }
- return self;
- }
- import "MyAnnotationPins.h"
- @interface SecondViewController : UIViewController < MKMapViewDelegate >
- @property (weak, nonatomic) IBOutlet MKMapView *mapView;
- @property (strong, nonatomic) MyAnnotationPins* biblioAnnotation;
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- mapView.delegate = self;
- MKCoordinateRegion mapRegion;
- mapRegion.center.latitude=-18.924129;
- mapRegion.center.longitude=-48.283963;
- mapRegion.span.latitudeDelta=0.2;
- mapRegion.span.longitudeDelta=0.2;
- [mapView setRegion:mapRegion animated:YES];
- ///// This is just for One annotaion/Pin on Map /////
- CLLocationCoordinate2D parliamentLocation = CLLocationCoordinate2DMake(-18.924129, -48.283963);
- biblioAnnotation = [[MyAnnotationPins alloc]
- initWithCoordinate:parliamentLocation
- title:@"Ponto Biblioteca"
- subtitle:@"Taxi proximo"];
- [mapView addAnnotation:biblioAnnotation];
- CLLocationCoordinate2D secondLocation = CLLocationCoordinate2DMake(another latitude, another longitude);
- secondAnnotation = [[MyAnnotationPins alloc]
- initWithCoordinate:secondLocation
- title:@"Second Title"
- subtitle:@"Second subtitle"];
- [mapView addAnnotation:secondAnnotation]; <code>
- @property (strong, nonatomic) MyAnnotationPins* secondAnnotation;
- for(X in Y)
- {
- CLLocationCoordinate2D parliamentLocation = CLLocationCoordinate2DMake(-18.924129, -48.283963);
- MyAnnotationPins* biblioAnnotation = [[MyAnnotationPins alloc]
- initWithCoordinate:parliamentLocation
- title:@"Ponto Biblioteca"
- subtitle:@"Taxi proximo"];
- [mapView addAnnotation:biblioAnnotation];
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement