当我按下编辑按钮时,如何淡出单元格上的文本?

发布于 2024-09-07 01:00:12 字数 209 浏览 7 评论 0原文

我想让单元格上的文本标签在按下按钮时淡出。 我尝试指向我想要淡出的标签,但它只适用于最后一个单元格。

我发现 -(void) willTransitionToState:(UITableViewCellStateMask)状态 是解决这个问题的方法,但我不知道如何使用。 我是否需要创建一个新类作为 UITableViewCell 类的子类?

任何帮助将不胜感激。谢谢你!

I would like to make my text label on a cell fade out when I press a button.
I tried pointing the label I want to make fade out, but it just work for only last cell.

And I found out that
-(void) willTransitionToState:(UITableViewCellStateMask)state
is the way to solve this problem, but I don't know how to use.
Do I need to make a new class that is subclass of UITableViewCell class?

Any help will be appreciated. Thank you!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

橘味果▽酱 2024-09-14 01:00:12

您尝试过使用 UIView 的动画吗?
那会是这样的:

// Where you want to make the label fade out
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3]; // in seconds, up to you
cell.textLabel.alpha = 0.0;
[UIView commitAnimations];

Have you tried using UIView's animations?
That would be something like this:

// Where you want to make the label fade out
[UIView beginAnimations:nil context:nil];
[UIView setAnimationDuration:0.3]; // in seconds, up to you
cell.textLabel.alpha = 0.0;
[UIView commitAnimations];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文