UITableView Grouped Routines

Often I see layouts on the iPhone, like the one I attached. enter image description here

How is this done best? With an interface constructor or programmatic way? How to add a subview to a UITableView without closing the actual cells of the table (for example, how to set the field to take place for subviews)?

Using Xcode4.2.

0
source share
4 answers

TableView has a header and footer, and each section also has tags.

to set the listening and footer of the table (green in my screenshot), do:

[self.tableView setTableHeaderView: headerView]; [self.tableView setTableFooterView: footerView]; 

for the header and footer for sections (blue), you have to implement

 -(UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section 

and

 -(UIView *) tableView:(UITableView *)tableView viewForFooterInSection:(NSInteger)section 

screenshot

You can find the code for the program shown on github

+2
source

This is usually done using the tableHeaderView and tableFooterView in the table view.

+1
source

Non-cell areas are typically implemented as section headers and footers.

0
source

It would be best to use an interface constructor. You can use the interface constructor to visually display all the actions with your code.

You can also use the interface constructor to change the layout of the view.

Hope this helps!

0
source

Source: https://habr.com/ru/post/1401766/


All Articles