Iphone 开发-> 在Tab Bar中使用Navigation

来源:互联网 发布:隐藏手机号码软件 编辑:程序博客网 时间:2024/05/17 01:23

 

 

 

Key concepts are: 

1) in Interface Builder view the MainWindow.xib file in the list view so you can see the hierarchy (as in image IB MainWindow_xib.jpeg) Select items from this window to modify them in IB Attributes inspector and IB Identity inspector. (other 2 images) 

2) Use the Attributes inspector to assign nib files to the correct places.

3) Use the Identity inspector to assign Objective-C class to the correct places.

To create the basic MainWindow.xib hierarchy using IB do as follows...

1) Drag a "Tab Bar Controller" from the library to the MainWindow.xib list.

2) Select this Tab Bar Controller in the MainWindow.xib list and go to the Attributes Inspector (Command-1), now in the View Controllers subwindow change the Class from "View Controller" to "Navigation Controller" for whichever items you wish.

3) Expand the "Tab Bar Controller" in the MainWindow.xib window in IB. (option-click arrow to expand all)

4) Leave the Navigation Controller as is

5) Select the View Controller and change its Class to your class and its Nib to use the corresponding nib. By using the Attributes inspector (Command-1) for the nib file and the Identity Inspector for the Class (Command-4)

6) Be sure to hookup action buttons to the File's Owner. 

7) Be sure to compile and test along the way so if you get off track you can backtrack easily. 

Good luck! I hope this community software emails me when the thread changes so I can field any questions you may have. Feel free to ask.

Scott
2 example:
 tabbar+navigation.zip
Attached Files
File Type: zipWordCheat.zip (30.8 KB, 460 views)File Type: zipIB images.zip (55.2 KB, 302 views)

 

 

 

注意 :当然tab bar 和navigation都被拖到MainWindow.xib后,其中的关键点有两个:1是将tab bar的某元素的class设置 为navigation Controller,2是需要在列表视图中设置藏在tab bar下面的navigation Controller到ROOT视图.