2

I am trying to build what is essentially a photo editing app where I can place "stamps" onto an image.

I am using a UICollectionView to contain all the stamps to choose from.

What I am trying to accomplish is have this collection view slide in from the bottom of the screen when the "Stamps" button is pressed from the main view.

Currently the collection view exists on the Storyboard with a Y position of 568 (bottom of an iPhone 5 screen - not visible).

I'm not an XCode veteran by any means so sometimes I am not aware of "best practices" when it comes to this kind of functionality that is commonly seen in apps today.

Is it better to try and animate the UICollectionView itself? Or is it better to try and place the collection view into its own UIView and animate that view?

Since I want this app to be used on iPhone 5 and larger screen of the iPhone 6, I'll make sure to take care of dynamically resizing the collection view and it's contents before the animation takes place.

Anyhow if anyone has any insight on the most efficient way to achieve this slide-in-from-bottom animation, using certain animation classes etc., on a collection view, that would be a great help! I am attaching an animated GIF to illustrate the effect I am going for.

enter image description here

John R.
  • 177
  • 11
  • 1
    Check to Display controller from bottom : http://stackoverflow.com/a/14732668/1450901 I think this is what you are looking for – IamAnil Oct 14 '15 at 09:31
  • 1
    Why not presenting a new ViewController with your collection view instead of animating a view in fullscreen? – atulkhatri Oct 14 '15 at 11:49
  • @IamAnil Thanks for the link! It lead me to research more about segues, which I previously had no clue about. "Modal" segue is exactly what I needed. – John R. Oct 15 '15 at 07:17
  • @JohnR. Please approve the answer and upvote my comments if it was useful :) – IamAnil Oct 15 '15 at 07:19
  • @atulkhatri That is exactly what I ended up doing. I placed a collection view in a new view as you suggested and then segued into it from the main view. Previously I thought placing all the views into a main view then animating them in and out of frame was the way to do things. I am a no0b! – John R. Oct 15 '15 at 07:21
  • Glad it helped you, we all face these kind of troubles in the beginning. Anyways I have posted it as an answer, please upvote/mark the same. \^/ – atulkhatri Oct 15 '15 at 10:13

1 Answers1

0

Use - (void)presentViewController:(UIViewController *)viewControllerToPresent animated: (BOOL)flag completion:(void (^ __nullable)(void))completion method to present a view controller instead of animating view. It also helps keep your code segregated. Happy coding!

atulkhatri
  • 10,896
  • 3
  • 53
  • 89