我试图找到Xamarin.iOS的像素转换距离。我知道这是你如何做到这一点,但你怎么会在Xamarin / c#中做到这一点?
MKCoordinateRegion myRegion = MKCoordinateRegionMakeWithDistance(mapView.centerCoordinate,400,0);
CGRect myRect = [mapView convertRegion:myRegion toRectToView:nil]; NSLog(@"宽度为400米是%f",myRect.size.width);
任何帮助或指导将不胜感激!!谢谢!
答案 0 :(得分:3)
MKCoordinateRegion myRegion = MKCoordinateRegionMakeWithDistance(mapView.centerCoordinate, 400, 0);
CGRect myRect = [mapView convertRegion: myRegion toRectToView: nil];
NSLog(@"width for 400m is %f", myRect.size.width);
Xamarin.iOS
转换:var myRegion = MKCoordinateRegion.FromDistance(mapView.CenterCoordinate, 400, 0);
var myRect = mapView.ConvertRegion(myRegion, null);
Console.WriteLine($"width for 400m is ${myRect.Size.Width}");