Computer

Creating Tableviews Using Scrollviews for iPhone Apps Development – Part 1

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. 

  1. 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.
  1. 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.
Be the FIRST to Know - Join Our Mailing List!

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Previous ArticleNext Article
Digital Infoware is a leading mobile app development company that offers complete solution for iphone app development, android app development at affordable price.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Send this to a friend