Apple defines a plain table view like the following:
Plain. In the plain style, rows can be separated into labeled sections
and an optional index can appear vertically along the right edge of
the view. A header can appear before the first item in a section, and
a footer can appear after the last item.
Or in more detail:
A table view in the plain (or regular) style displays rows that
stretch across the screen and have a creamy white background (see
Figure 1-1). A plain table view can have one or more sections,
sections can have one or more rows, and each section can have its own
header or footer title. (A header or footer may also have a custom
view, for instance one containing an image). When the user scrolls
through a section with many rows, the header of the section floats to
the top of the table view and the footer of the section floats to the
bottom.
A variation of plain table views associates an index with sections for
quick navigation; Figure 1-2 shows an example of this kind of table
view, which is called an indexed list. The index runs down the right
edge of the table view. Entries in the index correspond to section
header titles. Touching an item in the index scrolls the table view to
the associated section. For example, the section headings could be
two-letter state abbreviations, and the rows for a section could be
the cities in that state; touching at a certain spot in the index
displays the cities for the selected state. The rows in indexed lists
should not have disclosure indicators or detail disclosure buttons,
because these interfere with the index.
Now you can have custom cells instead of the four default styles (Default, Subtitle, Value 1, Value 2). If you have a "crazy" custom cell is it still a "plain" table view? Or is it only valid for the default styles? Because the docs only shows the default styles on the screenshots.
The tableview style affects the table view — not the table view cells. So yes, a plain tableview can — and should have — custom cells.
Related
I have a collection view 3x3.
Item (collection cell) contains some icon and label.
I want some additional text to be shown inplace when user touches the cell. The view with this text must be fullscreen width.
In other words I want to insert a view with text between collection rows. It's desirable that the view appears with animation.
How should I do that? The first ideas I've got are:
Divide CollectionView rows into sections and use section footer for this purpose. Make this footer of zero size and show it when needed.
Dynamically create full-width cell and insert it at the end of the row where selected item is located.
Both methods seems tricky to me. Maybe there is more straight forward way?
Any ideas? Thanks!
I would like to create the following, but not absolutely sure which one is the best to use: UITableView or UICollectionView?
Table views only do a single vertical list of cells. If you need a grid with rows and columns then you need a collection view.
If the 3 parts of your A-G rows are separate sections of single items then you might use a table view. (Say the left column contains an image, the middle column contains a title and subheading, and the right column contains a description of the item.)
I know the title is confusing. So I explain what I expect.
I have 3 sections in my table view. The first section has one or more rows. And second and third sections has only one row. When the first section has more than 4 rows the next sections going to be visible by scrolling table view bottom.
But I need these sections be visible in this case.
Actually I need show these sections at the bottom of the visible frame when first section has more than 4 rows!
Is it possible ?
The thing you can do it to display only the 3 first rows of the first section and then when the user starts scrolling, you add the additional cells to the first section while he is scrolling until you've added all of your cell.
Do the opposite when scrolling to top.
You can use two different TableView instead of one.
declare first TableView with only one section & seconds TableView with two section with one row each.
for that you need to use UIViewController instead of UITableViewController.
in this way your bottom TableView Cell always stay visible while first TableView can scroll with more cells.
I have a UITableView with many sections. It is a simple table view. I am using viewForHeaderInSection to create custom views for these headers. So far, so good.
The default scrolling behavior is that when a section is encountered, the section header stays anchored below the Nav bar, until the next section scrolls into view.
My question is this: can I change the default behavior so that the first section header stay anchored at the top for all sections?
Thanks.
Desired Behavior image url:
https://www.dropbox.com/s/2lnspddx02aku1n/scroll.png?dl=0
I've done this by augmenting the header/data relationship. You can have a section header on even numbered sections, and data in odd numbered sections.
Example: For section 0, you can show the appropriate heading, but have 0 rows in that section. The data for section 0 should show up in section 1. Section 1 will not have a header. etc etc.
I want sections would have same behavior as cells when I drag it.
Usual behavior is — when dragging cells, section stands on a same place until it meets other section.
What I want is section drags as usual cell.
The following is from the UITableView Class Reference
Table views can have one of two styles, UITableViewStylePlain and
UITableViewStyleGrouped. When you create a UITableView instance you
must specify a table style, and this style cannot be changed. In the
plain style, section headers and footers float above the content if
the part of a complete section is visible.
If you are going to use the UITableViewStylePlain, I am not sure you can re-engineer the section headers to not float.
An alternative is to use the UITableViewStyleGrouped or use UITableViewStylePlain and instead of using sections, you could separate out your table view by placing the section as another cell.