我的問題只發生在iPad上。 MKMapView總是存在未渲染部分(下圖右側)。只要我觸摸這個窗口,mapview重新繪製自己就好了。但它永遠不會馬上呈現正確。在iOS 4.2以及模擬器和設備中的iOS 3.2中發生此問題。該構造的MKMapView的代碼是正確的下面:在iPad上MKMapView呈現問題
- (void)viewDidLoad {
[super viewDidLoad];
mapview = [[[MKMapView alloc] initWithFrame:CGRectMake(0,0,self.view.frame.size.width,230)] autorelease]; // because of apples bug
mapview.autoresizingMask = UIViewAutoresizingFlexibleWidth;
MKCoordinateSpan globe = MKCoordinateSpanMake(100, 100);
CLLocationCoordinate2D worldCenter; worldCenter.latitude = 42.032974; worldCenter.longitude =21.359375;
MKCoordinateRegion worldmap = MKCoordinateRegionMake(worldCenter, globe);
mapview.region = worldmap;
mapview.zoomEnabled = NO;
mapview.showsUserLocation = YES;
mapview.delegate = self;
NSRange theRange;
theRange.location = 1;
theRange.length = [annotations count]-1;
[mapview addAnnotations:[annotations subarrayWithRange:theRange]];
[self.view addSubview:mapview];
}
的問題表現只在橫向方向。
UPDATE
這是怎麼跨越後,我感動的看法。
貌似你試圖中心與跨度過大的地圖來填滿整個屏幕的世界中心的地圖?據我所見,在屏幕右側沒有地圖「左」可供渲染 - 即這是世界末日:) - 因此,請嘗試播放跨度值以查看它是否能解決您的問題。 – Rog 2011-02-25 23:07:34
@Rog只要我觸摸這個視圖,它就呈現得很好。它總是有足夠的世界觀,因爲它通過削減地球的高度來自動縮放。 – bioffe 2011-02-25 23:14:34
當你觸摸屏幕並重新渲染時,你在右側看到了什麼酷炫的東西?我只是試圖在地圖應用上進行最大縮小,右側與上面張貼的內容相吻合,所以我很好奇!? – Rog 2011-02-25 23:27:32