详细视图仅显示在屏幕的表格区域中?
我希望能够显示表格的详细视图,但不推送新屏幕,而只显示表格所在的详细视图。
如果确实可能的话,最好的设置方法是什么?
------------------------------------
| |
| nav bar or tool bar |
------------------------------------
| |
| this area stays static |
| |
------------------------------------ ---------------------------------
| | | |
| | | |
| | | |
| table… | | new uitableview pushed. |
| | cell clicked-> | only the table area changes |
| | | |
| | | |
| | | |
------------------------------------ ---------------------------------
| | | | | |
| | | | | | < tab bar
| | | | | |
------------------------------------
I'd like to be able to show the detail view of a table, but not push a new screen, but only show the detail view where the table is.
What's the best way of setting this up.. if it is actually possible?
------------------------------------
| |
| nav bar or tool bar |
------------------------------------
| |
| this area stays static |
| |
------------------------------------ ---------------------------------
| | | |
| | | |
| | | |
| table… | | new uitableview pushed. |
| | cell clicked-> | only the table area changes |
| | | |
| | | |
| | | |
------------------------------------ ---------------------------------
| | | | | |
| | | | | | < tab bar
| | | | | |
------------------------------------
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您想要类似于推送 UIViewController 的效果,我想您可以将 tableview 动画化并同时将新视图动画化到位。我认为没有办法使用实际的 UINavigationController 机制来做到这一点,因为它用新的视图控制器的视图替换了 UINavigationController 堆栈上的当前视图。
If you want an effect similar to pushing a UIViewController I guess you could animate the tableview out and animate the new view into position at the same time. I don't think there's a way to do it using the actual UINavigationController mechanism, as it replaces the current view on the UINavigationController's stack with the new viewcontroller's view.
我建议使用两种方法:
uitableView
插入到UIView
中,这样您将始终可以引用保存 uitable 视图的容器。此外,您只需要管理此表视图的子子视图
的框架大小。在您的情况下,它将是第一个uitableview
,单击按钮后可以使用父容器
的引用添加下一个子视图。uitableview
之上的印象。I would suggest two methods:
uitableView
into aUIView
, this way you will always have reference to a container which holds the uitable view. Also you need to just manage the frame sizes of the childsubviews
of this table view. In your case it would be the firstuitableview
and on button click the next subview can be added using the reference of theparent container
.uitableview's frame
with respect to the parent UIView. On inserting another subview you can set the frame therby giving an impression of overlaying above the baseuitableview
.只需在表视图顶部添加另一个视图并将其隐藏即可。设置内容并在需要时取消隐藏。
Just have another view on top of the table view and make it hidden. Set the contents and unhide it when needed.
在我看来,解决此问题的最佳方法是使用不显示导航栏且不填充屏幕的 UINavigationController。因此,您的静态区域只是普通的 UIView,但您的表格视图实际上位于 UINavigationController 内,但看起来像是一个普通的表格 - 因为导航栏是隐藏的。
这意味着您可以将“动态”内容推送到 UINavigationController,这将使屏幕的该部分产生动画效果,但屏幕的其余部分将保持静态。
The best way, in my opinion of resolving this is to use a
UINavigationController
that doesn't have its nav bar showing and doesnt fill the screen. So, your static areas are just plainUIView
s, but your table view is actually inside aUINavigationController
, but seems like it is a normal table - as the navigation bar is hidden.This means you would push the "dynamic" content to the
UINavigationController
and that would animate that section of the screen, but the rest of the screen would remain static.