简体   繁体   English

按下按钮按下iphone时翻转mapView?

[英]Flip mapView when button Pressed in iphone?

I have a mapview, and i want to display another view with flip of mapview like tabbarcontrollers flip when button pressed. 我有一个mapview,我想显示另一个视图翻转mapview像tabbarcontrollers翻转按下按钮。 Button is placed below the mapview(this occupies only 80% remaining 20%button), then how to flip only mapview without flipping the button. 按钮位于地图视图下方(这仅占80%剩余的20%按钮),然后如何仅翻转mapview而不翻转按钮。

Thanks in advance... 提前致谢...

You can use following method for this. 您可以使用以下方法。 If you find any difficulty please let me know. 如果您发现任何困难,请告诉我。

  1. Define a UIView flipContainerView that will contain either mapView or anotherView 定义一个包含mapView或anotherView的UIView flipContainerView
  2. Add mapView to flipContainerView (and not anotherView) and flipContainerView to self.view 将mapView添加到flipContainerView(而不是anotherView),将flipContainerView添加到self.view
  3. set frames of flipContainerView, mapView and anotherView appropriately. 适当地设置flipContainerView,mapView和anotherView的帧。 mapView and anotherView will have same frame. mapView和anotherView将具有相同的框架。
  4. Call following method to flip between mapView and anotherView 调用以下方法在mapView和anotherView之间切换
-(void) MapOranotherView
    {
        [UIView beginAnimations:nil context:NULL];
        [UIView setAnimationDuration:1.0];  
        [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromRight forView:flipContainerView cache:YES];
        if ([mapView superview])
        {

            [mapView removeFromSuperview];
            [flipContainerView addSubview:anotherView];
            [flipContainerView sendSubviewToBack:anotherView];
        }
        else
        {

            [anotherView removeFromSuperview];
            [flipContainerView addSubview:mapView];
            [flipContainerView sendSubviewToBack:mapView];
        }
        [UIView commitAnimations];
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM