2

My application has a paged scrollview. Each page of the scrollview has an instance of a view controller (buttonViewController) that shows a grid of buttons. If the user clicks on one of the buttons, buttonViewController launches a detailViewController modally, with animation set to YES.

If I'm viewing the first page (furthest left) or the scroll view, everything work's correctly. However, if I am scrolled to any of the other pages, the modal view animation (sliding up from the bottom in this case) doesn't appear. Instead, the whole view goes black for the same length of time that the animation would run for, and then the modal view controller appears fully displayed. The same thing happens when dismissing the modal view controller.

The code is completely standard. In my buttonViewController I call:

[self presentModalViewController:detailController animated:YES];

The same code runs no matter which page I'm looking at (though on different instances of buttonViewController of course.)

How would I start debugging this?

4

2 回答 2

2

This might have to do with the frame of the detailController...When you are in a UIScrollView, the first page is between 0 and 320, however when you scroll that offset increments, so (assuming you have full screen pages) the next view will be 320 and 640, the next one will be in 640 and (640+320), and so on and so forth. So when you are setting up your detailController with frame CGRectMake(0,0,320,460), when you are in the first page, the animation will look fine, but when you are in any other page the animation will take place at (0,0) and then im guessing the viewcontroller sees this is not the active screen a nd moves the modal view controller to where the active screen is. If you initialize your frame like this CGRectMake(320*pageNumber,0,320,460) I think youll have the d esired behavior you are looking for. Let me know if this works im curious myself.

于 2009-07-28T17:32:38.663 回答
0

您需要在您尝试制作动画的视图下插入一个 UIView(或任何类型的视图,例如 UIScrollView),您将获得正确的动画效果。我想这是因为您提供了动画所基于的视图。

于 2009-11-30T20:58:12.253 回答