点击时移动UITableViewCell的内容 [英] Moving content of UITableViewCell on tap

查看:178
本文介绍了点击时移动UITableViewCell的内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果任何人都有 Google+应用程式,当然可以了解我要执行的内容。

解释:

解决方案

问题是你试图改变视图的框架自动布局打开。你不能这样做。自动布局系统将覆盖您的更改。尝试关闭自动布局在你的故事板,你会看到它的工作原理。



所以你的选择是:


  1. 不要使用自动布局

  2. 使用/操纵约束而不是框架。

对于(2),你可以进入故事板,并在容器视图上设置宽度和高度约束,它将工作。如果固定大小不是您想要的确切行为,您需要在您的要求中更加明确。



您现在获得的默认约束附加到父视图,并且当您将视图移动到新父级时,不会继续运行。


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



WHAT HAPPEN WITH CURRENT IMPLEMENTATION



WHAT SHOULD HAPPEN

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.

这篇关于点击时移动UITableViewCell的内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆