UITableView的固定图像背景 [英] UITableView with fixed image background

查看:233
本文介绍了UITableView的固定图像背景的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

很抱歉,但我发现,没有明确的答案。
我有一个标签栏,并在每个标签一个UINavigationController一个iPhone应用程序。
该接口是建立与界面生成器,并在第一个选项卡有一个UITableView。
我有prepared包含一个表(T)和后面(图像作为主视图的子视图)的图像(IMG)的背景主视图(A)的厦门国际银行。
后来我分配的UITableViewController作为所有者。这就是问题的开始。
在IB如果我连接查看对我有一个运行时错误告诉我,控制器无法找到一个表。
如果我连接控制器观点与T一切工作正常,但并不表明IMG。

Sorry but I found no clear answer on that. I have an iphone app with a tab bar and a UINavigationController in each tab. The interface is built with Interface Builder, and in the first tab there is a UITableView. I have prepared the xib with main view (A) containing a table (T) and an image (IMG) background behind (image as subview of main view). Later I assigned UITableViewController as owner. This is where problems start. In IB if I connect view to A I got a runtime error telling me that controller cannot find a table. If I connect controller view to T everything works fine, except that IMG is not shown.

我发现的唯一的解决方案是创建一个新的厦门国际银行持有A和IMG与一个UIViewController作为所有者。然后创建一个厦门国际银行控股只有T和的UITableViewController作为所有者,正确连接到T.
然后在的UIViewController viewDidLoad中:

The only solution I found is to create a new xib holding A and IMG with a UIViewController as owner. Then create a xib holding T only and UITableViewController as owner, correctly connected to T. Then in viewDidLoad of the UIViewController:

iptc = [[IPPlantsTableViewController alloc] initWithNibName:@"IPPlantsView" bundle:[NSBundle mainBundle]];

iptc.navigator=self.navigationController; // <-- need this

[self.view addSubview:iptc.view];

和这部作品,除了表视图,似乎不知道什么navigationController因此细节视图机制不能正常工作,除非我的UITableViewController设置属性吧。
我也给其他一些问题的添加/删除/创建行表运行的,例如所有的逻辑已经在UIViewController中进行处理,并送至的UITableViewController。

And this works, except that the table view seems to not know anything about navigationController, therefore detail view mechanism is not working, unless I set a property for it in UITableViewController. I also run in to some other problems, for example all the logic for adding/deleting/creating rows to table has to be handled in UIViewController and sent to UITableViewController.

有另一种方式为在表视图中有一个固定的形象?

Is there another way for having a fixed image in a table view ?

推荐答案

的UITableViewController是一个方便的类;你同样可以只使用的UIViewController和执行正确的回调。

UITableViewController is a convenience class; you can equally just use UIViewController and implement the correct callbacks.

在OS 3.2+,你可以设置UITableView.backgroundView。如果IB不会让你这样做,你能做到在code来代替。

In OS 3.2+, you can just set UITableView.backgroundView. If IB doesn't let you do this, you can do it in code instead.

另外,你或许能连线了视图的tableView 网​​点不同,除非的tableView少了点(UITableView的*)self.view

Alternatively, you might be able to wire up the view and tableView outlets differently, unless tableView just does (UITableView*)self.view.

这篇关于UITableView的固定图像背景的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆