UITableViewCell 标签显示有很少的上滑动画 [英] UITableViewCell label displayed with little slide up animation

查看:14
本文介绍了UITableViewCell 标签显示有很少的上滑动画的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 tableView 中显示人员列表.单击任何单元格时,应用程序会显示一个新屏幕.当用户返回上一个屏幕时,应该会出现一个 tableView.在这里,当用户使用 tableView 回到屏幕时,我调用服务器 API 来获取更新的人员列表并重新加载表格以显示他们.

I am displaying list of persons in a tableView. On clicking any of the cell, app displays a new screen. When user comes back to previous screen, a tableView should appear. Here, when user comes back to screen with tableView, I call server API to get updated list of people and reload table to display them.

问题是当用户返回屏幕并显示 tableView 时,UITableViewCell 中的标签有点动画.该动画是这样的,标签从其正确位置下方的某个位置移动,并且动画向上移动到其正确位置.这个动画不是我实现的,我也不想要.它的可见时间约为 0.5-1 秒.

The issue is when user comes back to screen and tableView is displayed, label in UITableViewCell is animated a little bit. This animation is such that label moves from some place below its correct position and animation upwards to its correct position. This animation is not implemented by me, neither do I want it. Its visible for around 0.5-1 sec.

比较下标签在动画前后的位置.

Compare below label's position before and after animation.

有人经历过吗?

注意: 请注意,我使用了自动布局.这可能是个问题,因为在使用自动布局之前,这个问题不存在.

尝试禁用隐式动画,如下所示,但不起作用.

Edit : Tried to disable implicit animation as shown below but not working.

NSMutableDictionary *newActions = [[NSMutableDictionary alloc] initWithObjectsAndKeys:[NSNull null], @"onOrderIn",
                                   [NSNull null], @"onOrderOut",
                                   [NSNull null], @"sublayers",
                                   [NSNull null], @"contents",
                                   [NSNull null], @"bounds",
                                   nil];
cell.textLabel.layer.actions = newActions;
cell.detailTextLabel.layer.actions = newActions;
cell.layer.actions = newActions;
cell.contentView.layer.actions = newActions;

推荐答案

解决了这个问题.抱歉打扰各位了.太傻了.当用户通过调用 REST API 从下一个视图控制器返回时,我正在刷新表格,然后调用从底部显示表格的方法 displayTable.现在,如果它已经显示,我调用 reloadData 方法来刷新它,而不是调用 displayTable.

Solved the issue. Sorry to bother you guys. It was so silly. I was refreshing the table when user comes back from next view controller by calling REST API and then calling a method displayTable which displays a table from bottom. Now, I call reloadData method to refresh it if its already displayed, instead of calling displayTable.

这篇关于UITableViewCell 标签显示有很少的上滑动画的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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