Tuesday, January 20, 2009

iPhone Development: Customizing HeaderView


This post will discuss how we can add a headerView to a UITableView and customize it.
The tableView will finally look like in the above figure. The headerView is the 30 pixel bar just below navigationBar and it reads "Last Synch ..."

How you make a tableView can be found anywhere on Internet, so I ll assume that you know how to make a tableView.

Open the viewController in which you have created your table and add the following code in header file within the interface declaration:

UIView *myHeaderView;


Now open the viewController in which you have created your table and add the following code in implementation file


I have created a method that will create and customize the headerView. You can call this method from viewWillAppear method.

Comments will be appreciated, if you still face any difficulty in creating a headerView, leave a comment and I will be more than happy to address it.




4 comments:

  1. I appreciate all your posts. They are too interesting & helpful. I wanted to know how you use XCODE to create CGI animations? I've been surfing a lot but not getting satisfactory results.

    ReplyDelete
  2. Hi Neha,
    sorry for the late reply..any specific reasons for using CGI and not UIViews/Images ?

    I am quite out of touch with new frameworks...opengl es is what you can use always.
    Other than that you can create animations by manipulating coordinates.

    ReplyDelete
  3. Hi,

    well, could you share how you created this editable UITableView that is seen in the picture ?

    ReplyDelete
  4. Hi Sebastian,
    sorry for the late reply,

    its actually not an editable view but a simple view. When in edit mode, you tap on a field to change it pushes another view with a text field/picker.

    ReplyDelete

Leave your suggestions