I created a UITableView programmatically and now I want to add a fixed header to it. As I the below code the header also scrolls with my tableview.
UILabel *label = [[[UILabel alloc]
initWithFrame:CGRectMake(0, 0, 320, 28)] autorelease];
label.backgroundColor = [UIColor darkGrayColor];
label.font = [UIFont boldSystemFontOfSize:15];
label.shadowColor = [UIColor colorWithWhite:0.0 alpha:0.8];
label.textAlignment = UITextAlignmentLeft;
label.textColor = [UIColor whiteColor];
label.text = @"my header";
myTable.tableHeaderView = label;
Is there a function which disables header scrolling?
Thank you
To disable floating but still show section headers you can provide a custom view with its own behaviours. Show activity on this post. Another way to do it is to make an empty section right before the one you want the header on and put your header on that section.
A view that presents data using rows in a single column.
No, you need to either change the view to be a section header (where it will remain at the top of the tableview while that section is visible), or you need to make the header view a sibling to the tableview in the tableview's superview -- you can create a UIView just for the purpose of holding the header view and the table view.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With