【问题标题】:Flip mapView when button Pressed in iphone?在iphone中按下按钮时翻转mapView?
【发布时间】:2012-02-08 14:52:34
【问题描述】:
我有一个地图视图,我想显示另一个带有地图视图翻转的视图,就像按下按钮时tabbarcontrollers 翻转一样。 Button放在mapview下方(这个只占80%,剩下20%button),那么如何只翻转mapview而不翻转按钮。
提前谢谢...
【问题讨论】:
标签:
iphone
transform
flip
mkmapview
【解决方案1】:
您可以使用以下方法。如果您发现任何困难,请告诉我。
- 定义一个 UIView flipContainerView 将包含 mapView 或 anotherView
- 将 mapView 添加到flipContainerView(而不是另一个视图)并将flipContainerView 添加到self.view
- 适当设置flipContainerView、mapView和anotherView的框架。 mapView 和 anotherView 将具有相同的框架。
- 调用以下方法在mapView和anotherView之间切换
-(无效)MapOranotherView
{
[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:1.0];
[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:flipContainerView cache:YES];
if ([mapView 超级视图])
{
[mapView removeFromSuperview];
[flipContainerView addSubview:anotherView];
[flipContainerView sendSubviewToBack:anotherView];
}
别的
{
[anotherView removeFromSuperview];
[flipContainerView addSubview:mapView];
[flipContainerView sendSubviewToBack:mapView];
}
[UIView 提交动画];
}