在 iPhone 中按下按钮时翻转地图视图?

发布于 2024-12-26 17:00:50 字数 120 浏览 7 评论 0原文

我有一个地图视图,我想通过翻转地图视图来显示另一个视图,就像按下按钮时选项卡控制器翻转一样。按钮放在mapview下面(这个只占80%剩下20%按钮),那么如何只翻转mapview而不翻转按钮。

提前致谢...

I have a mapview, and i want to display another view with flip of mapview like tabbarcontrollers flip when button pressed. Button is placed below the mapview(this occupies only 80% remaining 20%button), then how to flip only mapview without flipping the button.

Thanks in advance...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

你的心境我的脸 2025-01-02 17:00:51

您可以使用以下方法来实现此目的。如果您发现任何困难,请告诉我。

  1. 定义一个包含mapView或anotherView的UIView FlipContainerView
  2. 将mapView添加到flipContainerView(而不是anotherView)并将flipContainerView添加到self.view
  3. 适当地设置flipContainerView、mapView和anotherView的框架。 mapView 和 anotherView 将具有相同的框架。
  4. 调用以下方法在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];
    }

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
  2. Add mapView to flipContainerView (and not anotherView) and flipContainerView to self.view
  3. set frames of flipContainerView, mapView and anotherView appropriately. mapView and anotherView will have same frame.
  4. Call following method to flip between mapView and 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];
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文