문제

If anyone have Google+ App can certainly understand what I'm trying to implement.
(explained here: UIViewController Containment with animation like Google+)

I think it has something related with the new effect in iOS 7 Calendar App.
(explained here: Recreating iOS 7 Calendar UIView Animation)

-

This is a common animation effect that I'm seeing in many apps these days.

Months ago, the fellow Rob tried to help me with this his answer:

Now I was trying to implement it but there's a problem. Images explains better:


INITIAL STATE

enter image description here

WHAT HAPPEN WITH CURRENT IMPLEMENTATION

enter image description here

WHAT SHOULD HAPPEN

enter image description here

I've created a super simple project that shows the implementation (few lines).

Can someone help me to find where's the problem?

REPO: https://github.com/socksz/MovingTableViewCellContent

도움이 되었습니까?

해결책

The problem is that you're trying to change the view's frame with Auto Layout on. You can't do that. The Auto Layout system will overwrite your changes. Try turning off Auto Layout in your storyboard and you'll see that it works.

So your options are:

  1. Don't use Auto Layout
  2. Use/manipulate constraints instead of frames.

For (2) you can just go into the storyboard and set up width and height constraints on the container view and it will work. If fixed size isn't the exact behavior you want, you'll need to be more explicit in your requirements.

The default constraints you're getting now are attached to the parent view and aren't getting carried along for the ride when you move the view to a new parent.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top