简体   繁体   English

如何使用UITableViews设置Tab Bar iOS应用?

[英]How to set up a Tab Bar iOS app with UITableViews?

I am attempting to create a 3 tab iPhone Application with UITableViews on 2 of the tabs. 我正在尝试使用2个选项卡上的UITableViews创建3个选项卡的iPhone应用程序。 I think I remember reading somewhere in Apple's documentation that it's not kosher to put navigation controllers like the one supplied in the navigation template on a tab bar App. 我想我记得在Apple文档的某个地方读过,将导航控制器(如导航模板中提供的控制器)放在选项卡栏App上并不是犹太教。 However, this is precisely what I am attempting to do and I wanted to know how I would go about doing it? 但是,这正是我正在尝试做的事情,我想知道我将如何去做?

I started with the tab bar template and simply added this to the firstView header: 我从标签栏模板开始,然后将其简单地添加到firstView标头中:

@interface FirstViewController : UIViewController {
    IBOutlet UITableView *tableView;
}
@property(nonatomic,retain) IBOutlet UITableView *tableView;

@end

I added a UITableView through IB and set the delegate and datasource to the FirstViewController's File Owner, but for some reason, I am not seeing tableView when I try to set it as the outlet from File Owner. 我通过IB添加了UITableView,并将委托和数据源设置为FirstViewController的文件所有者,但是由于某些原因,当我尝试将它设置为文件所有者的出口时,我没有看到tableView。 It makes me think that I am possibly going about this the wrong way. 这使我认为我可能会以错误的方式进行操作。 Any advice at all would be greatly appreciated. 任何建议都将不胜感激。

I am fairly new to programming overall, so please try to be clear. 我对整体编程还是比较陌生的,所以请尝试清楚一点。

One way to approach it, from the nib, results in a structure looks like this: 从笔尖处接近它的一种方法导致结构看起来像这样:

Tab Bar Controller 标签栏控制器

-Tab Bar -标签栏

--Navigation Controller -导航控制器

---Navigation Bar - -导航栏

---View Controller 1 ---视图控制器1

---Tab Bar Item ---标签栏项目

--Navigation Controller -导航控制器

---Navigation Bar - -导航栏

---View Controller 2 ---视图控制器2

---Tab Bar Item ---标签栏项目

...etc ...等等

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

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