During a iPhone apps development process, iPhone app developers will find TableViews as a great tool for creating applications. However, some developers may face certain hitches for example, when creating a TableView in ScrollView with table scrolling disabled. The following are useful steps that will help you create a scrollview within an iPhone application.
-
Create Files
- Select the “Create new Project option” from Xcode.
- After selecting single view application, name the application as “TableView with ScrollView” with a prefix KE, activate ARC and Storyboards and target to universal.
- Then create a New Protocol by pressing cmd + N and select the Cocoa Touch category from the left menu. Then click on the Objective-C Protocol from the right. Save it with the name “KETableViewDataSource”. Repeat the previous steps but this time you should give the name of protocol as “KETableViewDelegate”.
- Again press cmd + N but select Objective-C class and name the file as “KETableView” make it subclass of UIView and save it.
-
Add Codes
- DataSource provides data to fill the table and delegate in order to manage the interactions.
- After adding the next methods to KETableViewDataSource, you can get a row show in the tableView. Then do the same thing for KETableViewDelegate.
- With the @optional line Xcode is confined to display the incomplete implementation warning.
- didSelectRowAtIndex: With this you can get the index of tableViewRow
- willDisplayCell: will be called each time a cell will get added to the table (new or recycled). The main idea is to open up the possibility to alter the cell before it is displayed.
- heightForRow: This is called every time you refresh the view, the default height is 50.0.
In this article:iphone app development, iphone applications developers, iphone apps developers
Written By
Jenifer Wong
Digital Infoware is a leading mobile app development company that offers complete solution for iphone app development, android app development at affordable price.

Click to comment