iPhone 中的卷页过渡动画不会让工具栏保持不变

发布于 2024-11-03 01:09:27 字数 931 浏览 5 评论 0原文

我正在尝试模仿 iPhone 上的地图应用程序中可以找到的部分页面卷曲动画。我可以让它部分卷曲,但工具栏随卷曲页面卷曲,这是我不想要的。我只希望屏幕底部的工具栏保持在原来的位置,而地图视图本身卷曲。

我在导航控制器视图中显示了地图视图。对我来说,如果我从根视图控制器加载此视图,并且我能够成功加载该视图,那么这是最有意义的,但是,动画无法按预期工作。视图从右侧滑动,而不是发生卷页动画,并且我设置的动画发生在视图内部的按钮内。这真的很奇怪......我什至尝试过非模态过渡样式并获得相同的效果。这是相关代码:

-(IBAction)displayInfoButtonTapped {
    NSLog(@"ParkingRootViewController displayInfoButtonTapped");
    
    MapInfoView *mapInfoView = [[MapInfoView alloc] initWithNibName:@"MapInfoView" bundle:nil];
    
    
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:mapInfoView.view cache:YES];
    [UIView commitAnimations];  
    
    [self.navigationController pushViewController:mapInfoView animated:YES];
    [mapInfoView release];
    
    [mapView displayInfoButtonTapped];
    
}

有人知道我做错了什么吗?或者有人有更好的方法来完成我想做的事情吗?谢谢!

I am attempting to mimic the partial page curl animation that can be found in the Map app that comes on the iPhone. I am able to get it to partially curl, but the toolbar curls with the curling page, which I don't want. I merely want the toolbar at the bottom of the screen to stay where it is while the map view itself curls up.

I have a map view display in a navigation controller view. To me, it makes most sense if I load up this view from the root view controller, and I am able to successfully, however, the animation does not work as anticipated. Instead of having the page curl animation occur, the sliding of the view from the right occurs and the animation I have set takes place within buttons inside of the view. It is really very strange... I have even tried non-modal transition styles and get the same exact effect. Here is the relevant code:

-(IBAction)displayInfoButtonTapped {
    NSLog(@"ParkingRootViewController displayInfoButtonTapped");
    
    MapInfoView *mapInfoView = [[MapInfoView alloc] initWithNibName:@"MapInfoView" bundle:nil];
    
    
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1];
    [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:mapInfoView.view cache:YES];
    [UIView commitAnimations];  
    
    [self.navigationController pushViewController:mapInfoView animated:YES];
    [mapInfoView release];
    
    [mapView displayInfoButtonTapped];
    
}

Anyone have any idea of what I am doing wrong? Or does anyone have a better method of how to go about doing what I am trying to do? Thanks!

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

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

发布评论

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

评论(2

離殇 2024-11-10 01:09:27

从 UiView 获得的卷曲动画始终是全屏的。太糟糕了。为了获得不同的卷发效果,你必须亲自动手
OpenGL。

The curl animations that you get from UiView are always full screen. Too bad. For a different curl effect you have to get your hands dirty with
OpenGL.

雨轻弹 2024-11-10 01:09:27

我可以完成此工作,但是通过具有多个视图并使用动画来删除顶部视图,将下部视图保留在适当的位置。卷页不会触及工具栏。这是我的代码。

[UIView beginAnimations:nil context:NULL];
[self.mapView removeFromSuperview];
[UIView setAnimationDuration:1.5];  
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
[UIView commitAnimations];

所以我的视图控制器有一个 MKMapView 和一个 tableView,地图视图位于顶部。当用户点击工具栏上的按钮时,上面的动画就会播放,并且地图视图会卷曲。

希望这是有道理的。

I have this working but by having mutiple views and using the animation to remove the top view leaving the lower view in place. The Page Curl doesn't touch the toolbar. Here's my code for it.

[UIView beginAnimations:nil context:NULL];
[self.mapView removeFromSuperview];
[UIView setAnimationDuration:1.5];  
[UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.view cache:YES];
[UIView commitAnimations];

So my view controller has a MKMapView and a tableView, the map view is on top. When the user taps a button on the toolbar the above animation is played out with just the mapView being curled away.

Hope that makes sense.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文