简体   繁体   English

UITableViewController和Storyboard

[英]UITableViewController with Storyboard

I have a subclass of UITableViewController. 我有UITableViewController的子类。

I overrid initWithCoder so that when the controller initializes it adds five items to the UITableView that it creates by default (I did not create a UITableView in IB because the UITableViewController creates one). 我overrid initWithCoder这样,当控制器初始化它增加了五个项目的UITableView ,它默认创建(我没有创建一个UITableView在IB因为UITableViewController创建一个)。

I would like to add a header (with 2 buttons) that I created in Interface Builder to that tableview. 我想将在Interface Builder中创建的标题(带有2个按钮)添加到该表视图。

I linked an IBOutlet to the header from Interface Builder and I set it to be the header of the UITableView created at initialization. 我将IBOutlet链接到Interface Builder的标头,并将其设置为初始化时创建的UITableView的标头。

The problem is that although I did this I only see the UITableView with the 5 items (displayed corectly) but I don't see the header. 问题是,尽管我这样做了,但我只看到了带有5个项目的UITableView (以核心方式显示),但没有看到标题。 It's like it ignores the header from the Storyboard or something like that. 就像它忽略情节提要中的标题或类似的东西一样。

Any idea why? 知道为什么吗?

Thanks. 谢谢。

I just captured one GIF from of my example StoryBoard that you can drag UIView on top of your UItableViewController and make it resize as par your need. 我只是从示例StoryBoard中捕获了一个GIF,您可以将UIView拖动到UItableViewController顶部,并根据需要调整其大小。 pelase check following. 请检查以下内容。

在此处输入图片说明

Hope that help to you. 希望对您有所帮助。 After drag view on UITableview you just need to create IBOutlet and make your task complete :D UITableview上拖动视图后,您只需要创建IBOutlet并完成您的任务即可:D

将uiwebview拖到tableview的第一个单元格的正上方。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM