marko
marko

Reputation: 1366

UITableView fixed header

How to disable scrolling for UITableView header, to be always visible? (To have column titles.)

Upvotes: 0

Views: 3487

Answers (1)

Sepehr Mahmoudian
Sepehr Mahmoudian

Reputation: 771

I am not sure if I am getting what you mean, are you using a UITableViewController?

If you want to have a header that is not scrollable maybe you can try to put a UIView at the top of your tableview and add sublayers to it as needed.

If a tableview with multiple fixed section headers is what you want, I would suggest using different tableviews and adding UIViews on top of each one for the header.

For handling delegate and datasource use NSObject's - (BOOL)isEqual:(id)anObject .

For example:

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{

  if ([tableView isEqual:markosFirstTableView])
  {
     return 1; 
  }

  else 
  {
     return 5;
  }

}

Does this help?

Upvotes: 3

Related Questions