How to dynamically change UITableView section header with scrolling. Or how to add a button to table section header?
Creating a simple subclass of UITableViewHeaderFooterView
helped. It kept all the standard behavior and visuals, while I just added a button on top.
Ungrouping UITableView Section Header when Header is top of view
I am not completely sure I follow what you are trying to accomplish, but please allow me to attempt to infer and feel free to provide clarifications. I like the table view practice :)
As I understand it:
1) You want the white view, the red view, and the table cells beneath the red view to scroll upward from the default position
2) You want the white view to scroll out of visibility
3) You want the red view to float at the top while the cells scroll beneath it
4) You currently have the white view as a table header, the red view as a section header, and the gray area are table cells
Sounds like a cool app!
Why not use 2 table sections:
1) Drop the table header
2) Set the white view in cell 0 section 0 of the table view.
3) Set table delegate methods so section 0 will have a nil header with 0 height
3.5) Also set the table delegate methods so section 1 will be your main table
4) Use UITableViewStylePlain so section 1 header will float at the top
Is this the desired functionality?
how to scroll uitableview, and section header in the top, visible and scroll to
UITableViewStyleGrouped = The section headers and footers do not float.
UITableViewStylePlain = Any section headers or footers are displayed as inline separators and float when the table view is scrolled
You just change the UITableViewStyle to UITableViewStylePlain
Then to scroll to particular row and section programatically you could use this below UITableViewMethod method.
//Scroll to First row in 2 section
[yourTableView scrollToRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:1]
atScrollPosition:UITableViewScrollPositionTop animated:YES];
Apple Documentation
how can i make headerView scroll (not stay on the top of the tableview ) accompanying with UItableViewCell when i was scrolling tableview
subclass the UITableView and override this method
- (BOOL)allowsHeaderViewsToFloat{
return NO;
}
same for footer
- (BOOL)allowsFooterViewToFloat{
return NO;
}
But I think that this is a private API ... You will not be able to submit it to the AppStore
If you will upload it to the AppStore; Then you have two other options
- Adding a normal cell instead of the section header
- If you have only one section, then you can simply use table header instead of section header
How to get a custom section header's background to respond to scrolling in table view
You can put your label inside a custom subclass of UITableViewHeaderFooterView which does it automatically for you,
Apologies, I only know Swift, but here are the steps explained:
Create your custom header class:
Next, register it to your tableview in viewDidLoad:
And, finally use it inside your viewForHeaderInSection:
Basically, create a custom subclass of UITableViewHeaderFooterView (in code or using nib), configure and add your label as a subview to the header's contentView, register the custom header to your tableview, and then call it in the delegate method
UITableView sections headers don't scroll synchronously
Answer by caram in the RubyMotion Motion forum
If you inherit from UITableViewController, self.view is already a tableView, so
you end up with 2 tableView. Just delete @table = UITableView.alloc.init...
http://community.rubymotion.com/t/uitableview-sections-headers-dont-scroll-synchronously/525
Related Topics
Determine on Iphone If User Has Enabled Push Notifications
Why Nsuserdefaults Failed to Save Nsmutabledictionary in Ios
How to Use Facebook iOS Sdk on iOS 10
How to Mimic the Bottom Sheet from the Maps App
How to Convert an Nsstring Value to Nsdata
Zooming Mkmapview to Fit Annotation Pins
Is There a Good Charting Library For Iphone
What Is an "Unwrapped Value" in Swift
How to Compress of Reduce the Size of an Image Before Uploading to Parse as Pffile? (Swift)
String Replacement in Objective-C
How to Turn Page Programmatically in Uipageviewcontroller
Outlets Cannot Be Connected to Repeating Content Ios
Cordova App Hanging During Startup on iOS 10
How to Make App Fully Working Correctly for Autorotation in iOS 6