Look at this video of the MLB At Bat app. Basically, I just want to present a modalViewController
with the UIModalPresentationFormSheet
style and have it grow from another view then flip. Like when you tap on a game in the scoreboard on the MLB app. Anyone know how I can accomplish this?
Thanks
EDIT: My main view is pretty much the same setup as the MLB app. I'm using AQGridView
and want the animation to occur when a cell in the grid view is tapped.
EDIT 2: I'd also be open to ditching the UIViewController
concept and just using a plain UIView
, then replicate the style of UIModalPresentationFormSheet
manually if that's easier.
EDIT 3: Okay, forget using a UIViewController
to do this, since I haven't gotten any responses, I'll assume it isn't possible. My new question is just how do I replicate the animation in the posted video using just UIView
's? So basically, the initial view needs to grow, move, and flip all at the same time.
EDIT 4: I think I have the actual animation figured out, now my only problem is calculating coordinates to feed into CATransform3DTranslate
. My view needs to animate pretty much exactly like in the video. It needs to start over another view and animate to the center of the screen. Here's how I'm trying to calculate the coordinates for the view that pops up in the center:
CGPoint detailInitialPoint = [gridView convertPoint:view.frame.origin toView:detailView.frame.origin];
CGPoint detailFinalPoint = detailView.frame.origin;
gridView
is the container view of my main view that holds the smaller grid items. view
is the specific grid item that we are animating from. And detailView
is the view that comes up in the middle of the screen.
To do a flip, grow, and translate animation you can use the following code:
Hope this helps!
I would use a UICollectionView with a custom UICollectionViewCell and animate in with its delegate call... Just an example for others to pick at.
You can implement your own transition using a category on UIViewControler.
UIViewController+ShowModalFromView.h
UIViewController+ShowModalFromView.m
This can easily be changed to use whatever animated transition you want; for your's, you might want to use a CA3DTransform. Hope this helps!
I would highly recommend taking a look at this post.
You shouldn't need to actually handle all this animation yourself.
If you use the
UIView
class method transitionFromView:toView:duration:options:completion: and passing inUIViewAnimationOptionTransitionFlipFromLeft
orUIViewAnimationOptionTransitionFlipFromRight
-- whichever way you want the animation to flip.I have implemented the same thing as shown in the MLB app using this method. Your
from view
would be the cell in the grid and theto view
would be the thing that would on the "back" of the cell.Hope this will reduce the overall code you'll need.
OK, I figured it out. Here's what I did:
I'm doing this with an item in an
AQGridView
. In my code sampleview
is the instance ofAQGridViewCell
that I am animating. Andvc.view
is my detailUIViewController
/UIView
that I'm displaying.