我有一个uiview,在uitableview和mkmapview之间切换。mkmapview在运行时创建,并在以下函数中设置动画:
[uiview beginanimations:nil context:null];
[uiview设置动画持续时间:0.5];
[uiview setAnimationTransition:(self.mapview==nil?uiviewAnimationTransitionflipFromRight:uiviewAnimationTransitionflipFromLeft)
forview:self.topview缓存:是];
//如果需要,创建新的地图视图。
如果(self.mapview==nil)
{
self.mapview=[[vtmapview alloc]initwithframe:self.topview.bounds];
mapview.maptype=mkmaptypestandard;
mapview.delegate=self;
mapview.scrolleenabled=是;
mapview.zoomenabled=是;
mapview.showsUserLocation=是;
}
//地图可见?显示或隐藏
如果(!)[自ismapvisible])
{
tableView.hidden=是;
[self.topview insertsubview:mapview above subview:self.tableview];
maploadcount=0;
}否则{
tableView.hidden=否;
[地图视图从超级视图中删除];
}
[uiview承诺];
< /代码>
它第一次运行良好,但在将来的运行中,在动画期间,在地图视图的顶部和底部都有水平条。看起来像这样:

我尝试过使用缓存设置、删除其他视图等。它不会在模拟器中发生,但会在OS 4.1.x和3.1.x上发生。
如果我不隐藏TableView,我会看到表的位而不是灰色条,因此我认为在翻转过程中MapView的大小不正确。
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:0.5];
[UIView setAnimationTransition:(self.mapView == nil ? UIViewAnimationTransitionFlipFromRight : UIViewAnimationTransitionFlipFromLeft)
forView:self.topView cache:YES];
// create new map view if necc.
if (self.mapView == nil)
{
self.mapView = [[VTMapView alloc] initWithFrame:self.topView.bounds];
mapView.mapType = MKMapTypeStandard;
mapView.delegate = self;
mapView.scrollEnabled = YES;
mapView.zoomEnabled = YES;
mapView.showsUserLocation = YES;
}
// map visible? show or hide it
if (![self isMapVisible])
{
tableView.hidden = YES;
[self.topView insertSubview:mapView aboveSubview:self.tableView];
mapLoadCount = 0;
} else {
tableView.hidden = NO;
[mapView removeFromSuperview];
}
[UIView commitAnimations];
它第一次运行良好,但在将来的运行中,在动画期间,在地图视图的顶部和底部都有水平条。看起来像这样:

我尝试过使用缓存设置、删除其他视图等。它不会在模拟器中发生,但会在OS 4.1.x和3.1.x上发生。
如果我不隐藏tableView,我看到的是表的一些位而不是灰色条,所以我认为在翻转过程中地图视图的大小调整不正确。