当前位置:网站首页>Xcode预览(Preview)显示List视图内容的一个Bug及解决
Xcode预览(Preview)显示List视图内容的一个Bug及解决
2022-06-24 19:55:00 【大熊猫侯佩】

概述
我们知道Xcode的预览(Preview)是开发SwiftUI界面的利器,其表现在:
- 快速显示SwiftUI视图界面
- 快速测试SwiftUI视图的功能
但遗憾的是,至今Xcode的预览功能仍有或多或少的问题,比如在某些条件下显示列表时,其中Cell视图的显示(onAppear)和隐藏(onDisappear)回调方法不会被调用:

我们希望在 noname 用户Cell隐藏时在主视图顶部显示用户面板,而在该Cell显示时隐藏顶部的用户面板。但如上图所示,无论何种情况,顶部的面板都没有显示。
包括Xcode 13.4和最新的Xcode 14beta 均有该问题。
那么,如何在Xcode预览中修复该Bug呢?
Let’s dive in!
顶部面板显示及隐藏逻辑
正如前面所说的,我们希望如下效果:
- 在List中 noname 用户Cell显示时,隐藏顶部的用户面板
- 在List中 noname 用户Cell隐藏时,显示顶部的用户面板
这是通过监听用户Cell的 onAppear 和 onDisappear 事件来实现的
边栏推荐
- Go crawler framework -colly actual combat (4) -- Zhihu answer crawl (2) -- visual word cloud
- Kubernetes 架构核心组件工作原理解析
- Investment analysis and prospect forecast report of global and Chinese triglycine sulfate industry from 2022 to 2028
- linux 系统redis常用命令
- Svg line animation background JS effect
- VIM use command
- Use coordinatorlayout+appbarlayout+collapsingtoolbarlayout to create a collapsed status bar
- Hibernate learning 3 - custom SQL
- Paint rounded rectangle
- Related operations of ansible and Playbook
猜你喜欢
5-minute NLP: summary of 3 pre training libraries for rapid realization of NER

C WinForm maximizes occlusion of the taskbar and full screen display

Im instant messaging development application keeping alive process anti kill

Difficult and miscellaneous problems: A Study on the phenomenon of text fuzziness caused by transform

传输层 以字节为单位的滑动窗口技术

傳輸層 以字節為單比特的滑動窗口技術

水库大坝安全监测

ros(25):rqt_image_view报错Unable to load plugin for transport ‘compressed‘, error string

A small program written this week

时间统一系统
随机推荐
Analysis report on development mode and investment direction of sodium lauriminodipropionate in the world and China 2022 ~ 2028
断言(assert)的用法
Simple collation of Web cache
Color gradient gradient color collection
Only positive integers can be entered in the text box
VNC viewer remote connection raspberry pie without display
Related operations of ansible and Playbook
Use and click of multitypeadapter in recycleview
Go crawler framework -colly actual combat (III) -- panoramic cartoon picture capture and download
Transition from digitalization to intelligent manufacturing
How to quickly open traffic master for wechat applet
More pictures | explain the Nacos parameters in detail!
im即时通讯开发应用保活之进程防杀
Android SQLite database
Unmanned driving: Some Thoughts on multi-sensor fusion
Use of JMeter
UE4 WebBrowser图表不能显示问题
Encryption and encoding resolution
微搭低代码中实现增删改查
Scrollview height cannot fill full screen