Skip to content

mgp/grouped-table-view-style

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

GroupedTableViewStyle

The GroupedTableViewStyle class has a collection of static utility methods that create views for headers and footers of a UITableView with style UITableViewStyleGrouped. The returned views have a style consistent with headers and footers generated by tableView:titleForHeaderInSection: and tableView:titleForFooterInSection:, respectively. The client is then free to modify these views before displaying them with table sections.

Creating views for headers

  • heightForHeaderInSection: returns the height for the header view of the given section. This method should be delegated to by tableView:viewForHeaderInSection:.
  • viewForHeaderInSection:withText returns a view for the header of the given section containing the given text. This method should be delegated to by tableView:viewForHeaderInSection:. Note that the view returned only supports one line of text; ensuring this is the responsibility of the client.

Creating views for footers

  • heightForFooterWithText:isLastSection: returns the height of the footer view containing the given text, which is also dependent on whether the section is the last section in the table. This method should be delegated to by tableView:heightForFooterInSection:.
  • viewForFooterWithText:isLastSection returns a view for the footer containing the given text. This method should be delegated to by tableView:viewForFooterInSection:.

GroupedTableViewStyleViewController

GroupedTableViewStyleViewController is a utility program to allow comparing the appearance of views generated by GroupedTableViewStyle with headers and footers generated by tableView:titleForHeaderInSection: and tableView:titleForFooterInSection:, respectively. It also demonstrates the delegation to GroupedTableViewStyle discussed above.

At the top of GroupedTableViewStyleViewController is a value USE_TITLES_NOT_VIEWS.

  • To display the UITableView with titles as headers and footers, set the value USE_TITLES_NOT_VIEWS to 1 (true) and then compile and run the program.
  • To display the UITableView with views generated by GroupedTableViewStyle as headers and footers, set the value USE_TITLES_NOT_VIEWS to 0 (false) and then compile and run the program.

About

Create views for headers and footers of a UITableView with style UITableViewStyleGrouped that are consistent with titles.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published