一個xib有兩個地圖視圖可能嗎?如果有可能如何在每個地圖視圖上顯示不同的數據?我搜索了很多,但找不到任何鏈接。如何在一個xib中處理兩個地圖視圖?
if (myMapviewLala.tag==1) {
MKCoordinateRegion region;
MKPointAnnotation *annotationPoint = [[MKPointAnnotation alloc] init];
coordinate.latitude = place.longitude;
coordinate.longitude = place.longitude;
region = MKCoordinateRegionMakeWithDistance(coordinate2,1000,1000);
MKCoordinateRegion adjustRegion = [myMapviewLala regionThatFits:region];
[myMapviewLala setRegion:adjustRegion animated:YES];
[annotationPoint setCoordinate:coordinate];
[myMapviewLala addAnnotation:annotationPoint];
}
if (myMapviewBNI.tag==0) {
MKCoordinateRegion region;
MKPointAnnotation *annotationPoint = [[MKPointAnnotation alloc] init];
coordinate.latitude = 51.638373;
coordinate.longitude = -0.46944;
region = MKCoordinateRegionMakeWithDistance(coordinate,15000,15000);
MKCoordinateRegion adjustRegion = [myMapviewBNI regionThatFits:region];
[myMapviewBNI setRegion:adjustRegion animated:YES];
[annotationPoint setCoordinate:coordinate];
[myMapviewBNI addAnnotation:annotationPoint];
}
請在問題中添加您的代碼,而不是在評論中。 – AtWork
@Abhishek加入 –
檢查myMapviewLala.tag == 1 ..中座標2的經度和緯度。 – AtWork