-
Notifications
You must be signed in to change notification settings - Fork 817
Allow left and right views to have a custom frame, giving more power to ECSlidingViewControllerLayout #244
Conversation
…t and underRight views can have different frames for each operation Signed-off-by: David Hart <david@atipik.ch>
…ample. Signed-off-by: David Hart <david@atipik.ch>
Signed-off-by: David Hart <david@atipik.ch>
…t and right views that can change frame. Signed-off-by: David Hart <david@atipik.ch>
Awesome, thanks for the PR. Some feedback:
I'd like to focus this PR on the changes you have for improving I want to see where you're going with the parallax transition, but I'd like to see it as a fork or separate project. Adding it to TransitionFun is going to be difficult to maintain (it already is with the 4 transitions already there). I plan on making each of the transitions from TransitionFun into their own projects. Eventually, there'll be a list of user contributed transitions on the Wiki. |
Can you explain why
What you say may be our mis-understanding. If I want the under views to move while revealing and resetting, shouldn't the initial frame and final frame be different? That's how I implemented the parallax effect at least. If change
I had forgotten to implement the delegate method to point to the layout :) Fixed now. Check it out, perhaps you can better understand the effect I wanted to achieve.
If you don't want to integrate it into the project, that's fine. I'll just keep it in my fork. But personally, I think it's a pitty not to grow the list of transitions in the TransitionFun project. First of all, the current transitions helped me quickly test that the modifications I made to the project did not break a transition. The more there is there, the more "testing" can be done. Secondly, if you keep the transitions with the project, it is a bit more work to maintain them. But I think that's better than having links in the wiki to transitions that may be outdated and not build with the latest version of ECSlidingViewController. |
This is the behavior for iOS 7 custom transitions. I now realize there's a bug with
The default animation specifically does not move the under view. Considering the bug I mentioned above, it should just set the final frame for the under view from the beginning. I see what you did now with the parallax transition. That's fantastic! The intent for TransitionFun was to demonstrate how to implement custom transitions. Separating them as their own projects will make them easily installable and usable for other users when packaged as a CocoaPod. Having different repos will make maintenance easier, since this repo won't be polluted with transition issues. As for versioning, your transition can be tied to a specific version of Great work by the way, I really like the parallax transition. |
Fixed the issue with |
Thanks for explanation, I was not aware of that! But there's something I still don't understand. If the |
The custom layout you used for the parallax transition happens to work with the default animation. The default animation simply animates from the starting frame to the ending frame, and since you customized the layout of the frames you were able to achieve the effect you wanted. After thinking about this more, I think the parallax transition would be better implemented with a custom animation instead of a custom layout. This removes its dependency from the default animation. Your custom animation is free to set the frames to whatever it wants to if the Custom layouts should return There's a lot of flexibility with customizing the transitions, so you're free to do whatever as long as it works for you. If your app is a single orientation and screen size, then you'll be able to get away with breaking more of these rules. What you did with the parallax transition is good, and it should work on iPad as well. The only caveat I can think of is that you are now responsible for handling any view controllers that have their You bring up some good points, I'll add some more notes to the docs about this. |
Thanks for the length explanation! I have a much better understanding of everything now. I think I'll reimplement the parallax effect using an animation instead of a layout as soon as I get some time. Meanwhile, can you recap what you'd like me to keep in the PR? |
Cool, I look forward to it. Just keep the changes related to |
Small recap of modifications:
underLeftViewCalculatedFrame
andunderRightViewCalculatedFrame
methods tounderLeftViewCalculatedFrameForPosition:
andunderRightViewCalculatedFrameForPosition:
to allow left and right views to control their frames when implementingECSlidingViewControllerLayout
.viewControllerForKey
that war returning the wrongUITransitionContextFromViewControllerKey
when the operation wasECSlidingViewControllerOperationResetFromLeft
orECSlidingViewControllerOperationResetFromRight
.initialFrameForViewController:
andfinalFrameForViewController:
to call the modified calculation methods.ECSlidingAnimationController
, simplifying it thanks to the bug fixed in 2, and so not to make any assumptions concerning the frame of left and right views.MEParallaxAnimationController
in the TransitionFun example that implements a parallax effect when showing left and right views, simply by implementingECSlidingViewControllerLayout
.