添加另一个类的视图
我有一个加载数据的表视图。该表视图具有“PullToRefreshTableViewController”作为超类。因此 .h 文件的顶部包含以下内容:
@interface NewsTable: PullRefreshTableViewController
由于这使整个视图成为表格视图,因此我无法在此之上添加任何类似工具栏的内容。
所以我想。我将制作一种容器类。其中包含工具栏,并添加带有 PullRefreshTableView 的类作为子视图。
我唯一遇到的问题是我不知道如何集成它?我应该怎么做才能在这个容器类中添加PullRefreshTableView?
我认为这就像
[containerclass addSubView:PullRefreshTableView]
但是,这当然不起作用,
谢谢你的努力!
更新: 工作代码是:
PullRefreshTableViewController *newsFeed = [[PullRefreshTableViewController alloc] init];
[self.view addSubview:newsFeed.view];
注意添加子视图后不要立即释放它
I have a table view which loads data. This table view has the "PullToRefreshTableViewController" as superclass. So the top of the .h file contains this:
@interface NewsTable: PullRefreshTableViewController
Since this makes the whole view an tableview I can't add anything like a toolbar on top of this.
So I thought. I'll make a sort of container class. One which has the toolbar in it, and also add the class with the PullRefreshTableView as a subview.
Only problem i'm having that I don't know how to integrate this? What should I do to add the PullRefreshTableView in this container class?
I think it's something like
[containerclass addSubView:PullRefreshTableView]
But of course this doesn't work
Thnx for your effort!
Update:
The working code is:
PullRefreshTableViewController *newsFeed = [[PullRefreshTableViewController alloc] init];
[self.view addSubview:newsFeed.view];
Beware to not release it as soon as you add the subview
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
用这个。调整子视图的大小以调整所有视图
use this one. Resize ur subview to adjust all the views
执行此操作,则应该是
如果您在视图控制器中
If you are doing this
in a view controller it should be