ios - 有什么方法可以阻止 SwiftUI Text 显示椭圆?
问题描述
我有一个文本视图,它根据状态变量的值动态显示不同的文本。当我循环浏览这些值时,如果新文本比旧文本长,我会在显示新文本之前暂时得到一个椭圆 (...)。遇到这种情况的代码如下所示:
Text(flashModeDescription(flashMode: appSettings.flashMode))
.font(.body).foregroundColor(.white)
.opacity(flashModeDescVisible ? 1: 0)
.animation(.easeIn(duration: 0.25))
Text 视图是 HStack 中的最后一项。
解决方案
This is due to animation defined, so the following could fix
Text(flashModeDescription(flashMode: appSettings.flashMode))
.font(.body).foregroundColor(.white)
.animation(nil) // << here !!
.opacity(flashModeDescVisible ? 1: 0)
.animation(.easeIn(duration: 0.25))
so animation would affect only opacity
推荐阅读
- jquery - 使用 resize() 事件时 insertAfter() 速度慢或根本不工作
- ruby-on-rails - 如何在 ruby 中正确使用 def 和 if..else 语句?
- angular7 - 使用路由保护时的路由导航问题
- laravel - 如何路由图像以避免来自 Google Cloud 的 404 错误?
- java - Mysql查询组装
- nao-robot - 使用robotutils lib通过javascript连接到本地naoqi时出现不正确的魔术错误
- python - 正则表达式结果为无
- javascript - VS Code 详细时没有登录到调试控制台
- c# - RX:如何等待订阅者完成?
- python - 散景中的分类条形图