Created
May 28, 2014 18:26
-
-
Save eito/485a14ffbfc08ea3d58e to your computer and use it in GitHub Desktop.
Test Custom Callout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@interface CalloutTest ()<AGSMapViewTouchDelegate> | |
@property (nonatomic, strong) AGSMapView *mapView; | |
@property (nonatomic, strong) UIView *customCalloutView; | |
@end | |
@implementation CalloutTest | |
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil | |
{ | |
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; | |
if (self) { | |
// Custom initialization | |
} | |
return self; | |
} | |
- (void)viewDidLoad | |
{ | |
[super viewDidLoad]; | |
// Do any additional setup after loading the view from its nib. | |
self.mapView = [TestUtility addMapViewToView:self.view]; | |
self.mapView.touchDelegate = self; | |
[TestUtility addOSMLayerToMap:self.mapView]; | |
self.customCalloutView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 500, 50)]; | |
self.customCalloutView.backgroundColor = [UIColor blueColor]; | |
self.mapView.callout.leaderPositionFlags = AGSCalloutLeaderPositionBottom; | |
self.mapView.callout.customView = self.customCalloutView; | |
} | |
- (void)didReceiveMemoryWarning | |
{ | |
[super didReceiveMemoryWarning]; | |
// Dispose of any resources that can be recreated. | |
} | |
- (void)mapView:(AGSMapView *)mapView didClickAtPoint:(CGPoint)screen mapPoint:(AGSPoint *)mappoint graphics:(NSDictionary *)graphics { | |
[self.mapView.callout showCalloutAt:mappoint pixelOffset:CGPointZero animated:YES]; | |
} | |
- (void)mapView:(AGSMapView *)mapView didEndTapAndHoldAtPoint:(CGPoint)screen mapPoint:(AGSPoint *)mappoint graphics:(NSDictionary *)graphics { | |
} | |
- (void)mapView:(AGSMapView *)mapView didTapAndHoldAtPoint:(CGPoint)screen mapPoint:(AGSPoint *)mappoint graphics:(NSDictionary *)graphics { | |
[self.mapView.callout moveCalloutTo:mappoint pixelOffset:CGPointZero animated:NO]; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment