iOS 5 Storyboard: How To use Segues, Scenes and Static Content UITableViews--Part II
来源:互联网 发布:淘宝火炬红包微信群 编辑:程序博客网 时间:2024/06/07 04:49
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 III
- 软件测试的原则
- Windows7中MSN自动脱机解决方法
- Visual Studio 2008快捷键之 控件操作快捷键
- iOS 5 Storyboard: How To use Segues, Scenes and Static Content UITableViews--Part II
- vc 加载bmp位图并显示的方法
- 用apache2.2发布ASP.NET3.5
- 安装OTRS
- socket
- 2011年7月 第28次中国互联网络发展状况统计报告
- VB datagrid分頁 總結
- xhtml 1.0和 html 4.01的区别、规范、选择
- C#中字符串操作总结