iOS 5 Storyboard: How To use Segues, Scenes and Static Content UITableViews--Part II
来源:互联网 发布:windows 98 编辑:程序博客网 时间:2024/05/17 08:36
Prototype Cells and Static Content
Other neat features of Storyboards are Prototype Cells and Static Content UITableViews. Lets first take a look at Prototype cells.
In the past we have to create our UITableViewCells in a nib and load them from the nib at runtime. This could result in lots of Cell nib files culturing up our project. Now we can create Prototype Cells directly inside our UITableViewController scene. In the following screenshot you can see our contacts UITableViewController scene where we have a custom prototype cell with a UIImageView and two labels.
To use your UITableViewCell prototypes you must provide them with a unique identifier that you set in Interface Builder. You can then dequeue the correct cell and set the content that it is to display in your cellForRowAtIndexPath method.
Note: That you can have as many different prototype cells as you wish the only requirement is that you set each one with a unique cell identifier.
It is also possible to create Segues between cells and ViewControllers to transition to a new scene when a cell is tapped. In the following screen shot you can see how to connect a cell to a UIViewController and by specifying Push as the transition mode we now have a detailed view pushed on whenever a cell is tapped.
As before we must specify an identifier for this Segue and pass data through to the view being shown via the prepareForSegue. This provides the newly presented view with the necessary data to be displayed.
Static Content UITableViews are an awesome new feature included in Storyboards. With Static UITableViews, cells can be designed inline without the need for an additional data source. Instead you can hook up UI elements that appear on different cells to IBOutlets in you UITableViewController class. In order to create a Static TableView layout you must change the Content type in the Attributes Inspector to Static as shown in the screen shot below.
I have also chosen to set the separator to none however you can leave the separator in if you wish to keep the UITableView look. Now that the view is laid out as we would like we can hook up the various UITextAreas and the UIImageView to your controller class. Finally I am going to finish with some additional Storyboard tips and resources.
- iOS 5 Storyboard: How To use Segues, Scenes and Static Content UITableViews--Part II
- iOS 5 Storyboard: How To use Segues, Scenes and Static Content UITableViews--Part II
- iOS 5 Storyboard: How To use Segues, Scenes and Static Content UITableViews--Part I
- iOS 5 Storyboard: How To use Segues, Scenes and Static Content UITableViews--Part III
- iOS 5 Storyboard: How To use Segues, Scenes and Static Content UITableViews--Part III
- iOS 5 Storyboard: How To use Segues, Scenes and Static Content UITableViews--Part I
- iOS Storyboard unwind segues使用
- iOS Storyboard unwind segues使用小结
- iOS Storyboard unwind segues使用小结
- How To: Compile and Use Tesseract (3.01) on iOS (SDK 5)
- iOS: How to use "Block"
- How to use Clang Static Analyzer
- Introduction to COM Part II - Behind the Scenes of a COM Server
- How to use cref links redirect to external content ?
- How to install and use doxygen
- How to Create and Use the DLL
- How To Use Function 'F4_FILENAME' and 'KD_GET_FILENAME_ON_F4'
- standard exception and how to use
- iOS 5 Storyboard: How To use Segues, Scenes and Static Content UITableViews--Part I
- 使用免费的Open NFC simulator模拟器在BlackBerry模拟器上进行NFC程序调试
- 信息安全产品
- 中中纳新 解题报告
- 中中救援队 解题报告
- iOS 5 Storyboard: How To use Segues, Scenes and Static Content UITableViews--Part II
- C#文件加密
- iOS 5 Storyboard: How To use Segues, Scenes and Static Content UITableViews--Part III
- 某阿里巴巴笔试题集第23题
- Java For 循环的高级应用
- In an iOS 5 Storyboard, how do you push a new scene to the original view controller from a Popover?
- UML中的六种关系
- JAVA中除数为0的问题
- 【教程】会声会影“分享”输出的AVI也可以既清晰又体积小