如何在基于 UITableViewController 的控制器上添加 UIImageView 覆盖?
XCode XIB 构建器中如何将 UIImageView 添加到具有 TableView 且基于 NavigationController 的现有 MasterViewController 中?
场景
- 例如,如果您在 XCode 4 中基于 MasterDetail 创建一个新项目
- ,然后查看 MasterViewController.xib 文件 - 因此想要向其中添加一个 UIImageView,该项目可用于超越屏幕,直到图像视图出现之前的某个点隐藏消失。
- 我试图将 UIImageView 拖到页面上,并将其放入“对象”列中的 TableView 中,但这不起作用。甚至不显示图像。
- 接管屏幕,也会向前迈出一步(不确定我是否需要一个视图来封装 UIImageView 和 TableView?)
因此
- ,即使只知道如何将图像拖放到 MastViewController.xib 上,以便它在启动时 要有一个iPhone应用程序在启动时显示的中间图像
- 想法将显示启动(静态)图像,然后立即转到MasterViewController,它将显示同一个静态图像,上面有一个活动指示器
- 然后当(是后台线程)数据准备是下来,UIImageView可以被
PS设置为不可见。一些附加说明:
- 最初,您在 MasterViewController.xib 中只看到一个表视图。
- 如果我将图像视图拖到与 TableView 相同的级别,它就不会出现。
- 如果我在 XIB 中创建一个新视图并将 tableview 和 uiimageview 放在该视图下,则在运行“'-[UITableViewController loadView] 加载了“MasterViewController”nib 但没有获得 UITableView。”时出现错误。
How does one in XCode XIB builder add a UIImageView to an existing MasterViewController that has a TableView and is based on NavigationController?
Scenario
- For example if you create a new project based on MasterDetail in XCode 4
- Then look at the MasterViewController.xib file - so want to add a UIImageView to this that could be used to overtake the screen up until a point after which the image view is made hidden to disappear.
- I'm trying to drag a UIImageView onto the page, and putting it just able TableView in the Objects column, however this doesn't work. Doesn't even show the image.
- So even just knowing how to drag-drop an image onto the MastViewController.xib such that it takes over the screen at startup would be a step forward (not sure if I need a view to encapsulate both the UIImageView and the TableView?)
Background
- Want to have an intermediate image that the iPhone app shows as it starts up
- Idea would be start up (static) image is show, then straight away go to MasterViewController which would show this same static image with an activity indicator on it
- Then when (is a background thread) the data preparation is down, the UIImageView could be made non-visible
PS. Some additional notes:
- Initially there is just a table view you see in MasterViewController.xib.
- If I drag an imageview in at the same level as the TableView it doesn't appear.
- If I create a new view in the XIB and put the tableview and uiimageview under this, I get an error when running "'-[UITableViewController loadView] loaded the "MasterViewController" nib but didn't get a UITableView.'"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
你的xib中有视图还是只有表格视图?如果你想在同一个视图控制器中同时拥有图像视图和表格视图,你应该有一个普通的 UIViewController 并让其实现 UITableViewDelegate 和 UITableViewDataSource 协议,并向其视图添加表格视图和图像视图。
Is there a view or just a table view in your xib? If you want both a image view and a table view in the same view controller, you should have an ordinary
UIViewController
and let in implement UITableViewDelegate and UITableViewDataSource protocols and add a table view and a image view to its view.因此解决方法是:
so solved by:
只需在资源中添加 Default.png 即可。
Just add Default.png in resource.