Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 TableViewController 中显示全屏信息而不是某些事件的表的最佳做法是什么,例如“需要登录”-带有 ImageView 和登录按钮的标签?
我认为,在单元格中添加内容并隐藏所有其他单元格应该可以工作,但不是最好的解决方案。
它应该看起来类似于“无法连接到 App Store”屏幕:应该有一个标签和一个按钮,并且视图不应该是可滚动的!
我所做的是使用带有 UITableView 和 UIView 的常规 UIViewController。
UIView 可以包含您想要在不显示表格视图时显示的任何内容。然后您只需隐藏或显示表格视图。
设置 UIViewController 时,您需要确保表明它实现了 UITableViewDataSource 和 UITableViewDelegate 协议,并将视图控制器设置为表视图的数据源和委托。这很简单。