Skip to content

Instantly share code, notes, and snippets.

Created December 9, 2015 08:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/4f04c3c1e1ab37a4a02c to your computer and use it in GitHub Desktop.
Save anonymous/4f04c3c1e1ab37a4a02c to your computer and use it in GitHub Desktop.
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
#import <CoreLocation/CoreLocation.h>
@interface InfoTableViewCell : UITableViewCell <MKMapViewDelegate>
@property (strong, nonatomic) IBOutlet UIButton *menuBtn;
@property (strong, nonatomic) IBOutlet UIButton *callBtn;
@property (strong, nonatomic) IBOutlet UIButton *moreBtn;
@property (strong, nonatomic) IBOutlet UIButton *directionsBtn;
@property (retain, nonatomic) IBOutlet MKMapView *mapView;
@end
#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
@interface MapPin : NSObject <MKAnnotation> {
CLLocationCoordinate2D coordinate;
NSString *title;
NSString *subtitle;
}
@property (nonatomic, assign) CLLocationCoordinate2D coordinate;
@property (nonatomic, copy) NSString *title;
@property (nonatomic, copy) NSString *subtitle;
@end
#import "MapPin.h"
@implementation MapPin
@synthesize coordinate,title,subtitle;
@end
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
if ([keys[indexPath.section] isEqual:@"Info"]) {
InfoTableViewCell *riCell = [tableView dequeueReusableCellWithIdentifier:@"riCell" forIndexPath:indexPath];
riCell.mapView.delegate = self;
MKCoordinateRegion region = { {0.0,0.0}, {0.0,0.0} };
region.center.latitude = 0;
region.center.longitude = 0;
region.span.latitudeDelta = 0.01f;
region.span.longitudeDelta = 0.01f;
[riCell.mapView setRegion:region animated:YES];
MapPin *ann = [[MapPin alloc] init];
ann.title = @"title";
ann.subtitle = @"subject";
ann.coordinate = region.center;
[riCell.mapView addAnnotation:ann];
[riCell.mapView selectAnnotation:ann animated:YES];
return riCell;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment