Detail Disclosure Button på mine MKAnnotations xcode
Hej Eksperten.dk!Jeg er meget ny til Objective C.
Jeg sidder lidt fast i noget Objective-C programmering her..
Jeg vil gerne have en Blå knap på mine annotations - hvordan gør jeg det?
Sætter pris på alt form for hjælp :)
ViewController.h:
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
@interface SCSecondViewController : UIViewController {
MKMapView *mapview;
}
@property (nonatomic, retain) IBOutlet MKMapView *mapview;
-(IBAction)setMap:(id)sender;
-(IBAction)getlocation;
@end
ViewController.m:
#import "SCSecondViewController.h"
#import "NewClass.h"
@interface SCSecondViewController ()
@end
@implementation SCSecondViewController
@synthesize mapview;
-(IBAction)getlocation {
mapview.showsUserLocation = YES;
}
-(IBAction)setMap:(id)sender {
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
[mapview setMapType:MKMapTypeStandard];
[mapview setZoomEnabled:YES];
[mapview setScrollEnabled:YES];
MKCoordinateRegion region = { {0.0, 0.0 }, {0.0, 0.0 } };
region.center.latitude = 52.509078;
region.center.longitude = -1.884799;
region.span.latitudeDelta = 0.01f;
region.span.longitudeDelta = 0.01f;
[mapview setRegion:region animated:YES];
NewClass *ann = [[NewClass alloc] init];
ann.title = @"England";
ann.subtitle = @"England";
ann.coordinate = region.center;
[mapview addAnnotation:ann];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
@end
NewClass.h:
#import <Foundation/Foundation.h>
#import <MapKit/MKAnnotation.h>
@interface NewClass : NSObject <MKAnnotation> {
CLLocationCoordinate2D coordinate;
NSString *title;
NSString *subtitle;
}
@property (nonatomic, assign) CLLocationCoordinate2D coordinate;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *subtitle;
@end
NewClass.m:
#import "NewClass.h"
@implementation NewClass
@synthesize coordinate,title,subtitle;
@end
Tak på forhånd!!
Hilsen Mathias