MKMapView 动画期间的神秘边框
我有一个 UIView,可以在 UITableView 和 MKMapView 之间切换。 MKMapView 在运行时创建,并在以下函数中进行动画处理:
[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
,我会看到表格的一些部分而不是灰色条,因此我认为在翻转过程中地图视图的大小调整不正确。
I have a UIView in which I flip between a UITableView and a MKMapView. The MKMapView is created at runtime and animated in the following function:
[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];
The first time it works fine, but in future runs there are horizontal bars on the top and bottom of the map view during the animation. It looks something like this:
I've tried playing with the cache setting, removing other views, etc. It doesn't happen in the simulator but it happens on OS 4.1.x and 3.1.x.
If I don't hide the tableView
, I see bits of the table instead of the grey bars, so I think the mapview is being resized incorrectly during the flip.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
更改此行:
更改为此行:
这就是答案。
Change this line:
To this line:
And that is the answer.