5

They both specify a map center and how big the box is.

So why use both?

Some function in MKMapview use one and some use the other

  • (MKCoordinateRegion)regionThatFits:(MKCoordinateRegion)region
  • (MKMapRect)mapRectThatFits:(MKMapRect)mapRect edgePadding:(UIEdgeInsets)insets

What's their difference?

More importantly, which one we should use to set the region we see?

There is no regionThatFits:edgePadding: by the way.

4

1 に答える 1

8

Aは、地球の表面上の点の緯度と経度を表すMKCoordinateRegionタイプの度座標を使用して定義されます。CLLocationCoordinate2D

MKMapRectマップビューのビュー座標(x、y)で定義された実際の平らな長方形を表します。

MKCoordinateRegionForMapRectのように、関数を使用して変換を行うことができます

http://developer.apple.com/library/ios/#documentation/MapKit/Reference/MapKitFunctionsReference/Reference/reference.htmlを参照してください

そして最後の質問に答えるには、これを使用MKCoordinateRegionして、地球の表面のどの領域を見たいかを定義し、定義上、ズームレベルを設定します。

于 2012-08-15T03:57:20.387 に答える