Я пытался и пытался заставить эту полилинию работать в Objective C. Я прошел через каждый учебник, который я могу найти и нигде не попал, я не могу понять, что с ним не так.Полилиния для MKMapView не работает
CLLocationCoordinate2D coordinateArray2[2];
coordinateArray2[1].longitude = 176.8773669;
coordinateArray2[0].longitude = 176.88151896;
coordinateArray2[0].latitude = -39.668593;
coordinateArray2[1].latitude = -39.67018069;
_route1Line = [MKPolyline polylineWithCoordinates:coordinateArray2 count:2];
[_GPSView setDelegate:self];
[_GPSView addOverlay:_route1Line];
_testlabel.text = [NSString stringWithFormat:@"%f", coordinateArray2[0].longitude];
Может ли кто-нибудь увидеть, что не так?
Заголовок:
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
extern int routenumber; //holds current route ID
extern BOOL inRoute; //holds if on route or not
extern int followYou; //holds if the app should follow the user or predefined coordinates
extern NSArray *routeHolder; //holds array of routes
@interface ViewController : UIViewController <MKMapViewDelegate>
@property (weak, nonatomic) IBOutlet MKMapView *GPSView; //adding the map view to the controller
@property (nonatomic, retain) MKPolyline *route1Line; //line for this route
@property (weak, nonatomic) IBOutlet UILabel *testlabel;
@end
жаль, игнорировать комментарии – Jobalisk