iOS:使用模态 pageFlip 在 UITableViewController 中制作奇怪的单元格动画 [英] iOS: Using modal pageFlip makes strange cell animation in UITableViewController

查看:20
本文介绍了iOS:使用模态 pageFlip 在 UITableViewController 中制作奇怪的单元格动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想显示一个设置视图,所以我想我可以使用 pageCurl 模式样式.我有一个 UIViewController,我正在展示它:

I wanted to show a Settings view, so I figured I could use the pageCurl modal style. I have a UIViewController that I am presenting from:

Settings *settings = [[[Settings alloc] initWithStyle:UITableViewStyleGrouped] autorelease];
settings.view.backgroundColor = [UIColor scrollViewTexturedBackgroundColor];
settings.modalTransitionStyle = UIModalTransitionStylePartialCurl;
settings.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentModalViewController:settings animated:YES];

当页面卷曲时,为了在下面显示我的 UITableViewControllercells subviews(标签和附件视图)似乎动画到位,这看起来很可怕:

When the page curls, to reveal my UITableViewController below, the cells subviews (labels and accessory views) seem to animate into position, which looks horrible:

奇怪的是,动画永远不会发生在一个部分的顶部单元格.其他 modalTransitionStyle's 不会发生这种情况,所以我想知道为什么会发生这种情况.这真的很令人沮丧,因为我不知道如何阻止这种情况发生.

The strange thing is, is that the animation never happens to the top cell in a section. This does not happen with other modalTransitionStyle's so I am wondering why this could be happening. It is really becoming frustrating because I cannot figure out how to stop this from happening.

想法?

推荐答案

我注意到这个奇怪动画的方向(UIButtons 也会发生这种情况),取决于在对象属性检查器的控制部分中选择的对齐方式(在界面生成器中).我整个晚上都在修补所有属性,但还没有找到解决方案.:(

I've noticed that the direction of this weird animation (which also happens to UIButtons), depends on the Alignment chosen in the Control section of the object's Attributes inspector (in Interface Builder). I've been tinkering with all attributes all evening and have found no solution yet. :(

编辑:所以,我在我的视图中有三个 UIButton(和一个 UIPickerView),它们同时在做这种奇怪的行为.我创建了一个链接到 UIButtons 之一的属性.然后,在此视图控制器的 viewDidLoad 中,我添加了以下行:

Edit: so, I had three UIButton in my view (and one UIPickerView) that where doing this weird behavior at the same time. I created a property linking to ONE of the UIButtons. Then, in the viewDidLoad of this view's controller I added the following line:

_firstAffectedButton.titleLabel.autoresizingMask = UIViewAutoresizingNone;

这为我修复了所有按钮和选择器!!:?很奇怪吧?

And that fixed it for me, for all the buttons and the picker!! :? Weird, right?

谁能解释为什么这是有效的?我觉得我正在做一些愚蠢的事情来解决这个问题,但我看不到它是什么.

Can anyone explain why this is working? I have the feeling I'm doing something stupid to fix this, but I can't see what it is.

编辑 2:原来有一个更好、更简洁的解决方案来解决这个问题.请参阅这篇文章.

Edit 2: Turns out there was a better and cleaner solution to this problem. See this post.

这篇关于iOS:使用模态 pageFlip 在 UITableViewController 中制作奇怪的单元格动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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