的UITableViewCell +自动布局+ RTL [英] UITableViewCell + Autolayout + RTL

查看:153
本文介绍了的UITableViewCell +自动布局+ RTL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我本地化我的应用程序,以希伯来文,这是一个RTL语言。结果
每个单元有设置为前/后这些都对RTL语言自动转换水平的制约。结果
最终的结果是完全符合市场预期,但通过表视图滚动时,在一个UITableViewCell子视图的动画从LTR到RTL,这是非常奇怪的。

I'm localising my app to Hebrew, which is an RTL language.
Each cell has horizontal constraints set as Leading/Trailing which are automatically reversed on RTL languages.
The final result is exactly as expected, but when scrolling through the table view, the UITableViewCell subviews are animating from LTR to RTL, which is very weird.

有一个变通为$ P $从动画pventing看法?

Is there a work around for preventing the views from animating?

例如:

也没有在所有的WWDC上的视频这​​个词...

Also not a word on this in all WWDC videos...

推荐答案

确定,所以基本上的UIView 与原来的布局开始,因为它出现在 *。厦门国际银行文件,然后改变布局作为设备的国产化。

OK, so basically UIView is initiated with the original layout as it appears on the *.XIB file, and then change the layout as the device's localization.

中显示我的的UITableViewCell 是第一次,没有动画,并正常显示,我以为我的的UITableView 被重新使用的细胞,因为这是我是如何定义它,但实际上,由于其他问题,我不慎引起的,滚动在我的tableView的内容大小被改变,而没有被重复使用旧的细胞,是什么导致像20活通过的同时表视图subviewed细胞,使每一个新行刚刚启动了一个新的的UITableViewCell ,因为在同一时间有一个方法执行

The first time my UITableViewCells were displayed, there were no animation and it displayed properly, I assumed my UITableView was reusing it cells because that's how I've defined it, but actually, due to another issue I've mistakenly caused, my tableView's content size was changed during the scroll and the old cells were not being reused, what caused to something like 20 "live" cells to be subviewed by the table view at the same time, so each new row just initiated a new UITableViewCell, and because at the same time there was a method executing

[UIView animateWithDuration:.2 animations:^{
    ...

    [self.view layoutIfNeeded];

    ...
}];

该小区的布局也从LTR到动画RTL布局。

The cell's layout was also animating from LTR to RTL layout.

总之,修我实施这种行为解决了电池的再利用,并造成全球视野的布局动画怪异动画。

Anyway, fixing my implementation for this behaviour solved the reusing of the cells and also the weird animation caused by the global view's layout animation.

希望这将帮助一些人谁遇到过类似的事情。

Hope it will help some else who encountered something similar.

这篇关于的UITableViewCell +自动布局+ RTL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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