iOS Uiview在设置为true之后再次显示不显示
我们在ViewController中有以下布局
TableView是空的。
该控制器通过使用事件系统对本地数据库的内容做出反应。这个想法是,如果用户执行手势以刷新表视图,则将本地数据库删除,并且控制器会收到一个空的项目,并且应显示任何没有发现的视图。下载新信息并填充数据库后,控制器再次接收一个带有列表项目的事件(或者列表为空等)。
在调试视图层次结构时,我们可以看到,在启动ViewController时,自定义视图“ Nothing fordound”就在其位置。然后,在从服务器下载新内容的同时,我们隐藏了Nothing fround视图,而Ishidden = true。
如果导致服务器用空列表响应,那么我们希望再次显示“无框”视图,然后将ISHIDDER = false设置。
但是它不起作用,该视图不会再次显示。在检查视图层次结构时,我们可以在导航器中看到该视图从层次结构中消失了(我们期望该视图在那里,但处于隐形状态,但也许我们错了)。
也许我们缺少某些东西,但是被命名为= false不应该使视图再次可见?还是还有另一种技术可以做到这一点?
在此先感谢
:我们已经尝试的事情:我们已经确保我们隐藏并再次显示主线程的视图,但这并不能解决问题。
在修改视图的属性之后,我们试图致电layoutifneed(),而没有结果。
We have the following layout in our ViewController
As you see, it is a UIView containing a TableView, and over the tableview, a custom view that displays a message if there is nothing to display, also when the tableview is empty.
This controller reacts to the content of a local database, by using an event system. The idea is that, if the user does the gesture to refresh the tableview, the local database is deleted, and the controller receives an empty array of items, and the nothing found view should be displayed. After new info is downloaded, and the database is filled with it, the controller receives again an event with the items for the list, (or maybe again the list is empty, etc).
When debugging the view hierarchy, we can see that when starting the ViewController, the custom view "NothingFound" is there in its place. Then, we hide the NothingFound view, while downloading new contents from the server, with isHidden=true.
If it results that the server responded with an empty list, then we want the NothingFound view to be displayed again, and we set isHidden=false.
But it does not work, the view is not displayed again. Examining the view hierarchy, we can see in the navigator that the view disappeared from the hierarchy (we were expecting the view to be there, but in invisible status, but maybe we are wrong).
Maybe we are missing something, but is isHidden = false not supposed to make the view visible again? Or is there another technique to do this?
Thanks in advance
PS: Things we already tried: we already make sure that we are hiding and showing again the view on the main thread, but this does not solves the problem.
We tried to call layoutIfNeeded() after modifying the property isHidden of the view, without result.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论