Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -(MKOverlayView *)mapView:(MKMapView *)mapView viewForOverlay:(id<MKOverlay>)overlay{
- //make a new overlay
- MKPolygonView *polyView = [[MKPolygonView alloc] initWithOverlay:overlay];
- //set things
- polyView.lineWidth = 1;
- //polyView.strokeColor = [UIColor blueColor];
- //get the image and make it fit the overlay
- UIImage *image = [UIImage imageNamed:@"map.jpeg"];
- MKMapRect theMapRect = [overlay boundingMapRect];
- CGSize size = CGSizeMake(theMapRect.size.width, theMapRect.size.height);
- UIGraphicsBeginImageContext(size);
- [image drawInRect:CGRectMake(0, 0, size.width, size.height )];
- UIImage *finalImage = UIGraphicsGetImageFromCurrentImageContext();
- UIGraphicsEndImageContext();
- //assign the final image as the fill color
- polyView.fillColor = [UIColor colorWithPatternImage:finalImage];
- return polyView;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement