• Complain

Duckett - Pro iOS Table Views and Collection Views

Here you can read online Duckett - Pro iOS Table Views and Collection Views full text of the book (entire story) in english for free. Download pdf and epub, get meaning, cover and reviews about this ebook. City: Berkeley;CA, year: 2015, publisher: Apress, genre: Computer. Description of the work, (preface) as well as reviews are available. Best literature library LitArk.com created for fans of good reading and offers a wide selection of genres:

Romance novel Science fiction Adventure Detective Science History Home and family Prose Art Politics Computer Non-fiction Religion Business Children Humor

Choose a favorite category and find really read worthwhile books. Enjoy immersion in the world of imagination, feel the emotions of the characters or learn something new for yourself, make an fascinating discovery.

Duckett Pro iOS Table Views and Collection Views
  • Book:
    Pro iOS Table Views and Collection Views
  • Author:
  • Publisher:
    Apress
  • Genre:
  • Year:
    2015
  • City:
    Berkeley;CA
  • Rating:
    5 / 5
  • Favourites:
    Add to favourites
  • Your mark:
    • 100
    • 1
    • 2
    • 3
    • 4
    • 5

Pro iOS Table Views and Collection Views: summary, description and annotation

We offer to read an annotation, description, summary or preface (depends on what the author of the book "Pro iOS Table Views and Collection Views" wrote himself). If you haven't found the necessary information about the book — write in the comments, we will try to find it.

Table views and collection views are the bread and butter of iOS apps. With them, you can create everything from the simplest of lists to fully tricked-out user interfaces. Pro iOS Table and Collection Views with Swift covers table views and collection views on all sizes of iOS devices, including the new Apple Watch.;Chapter 1: Table Views Quick Start -- Chapter 2: Collection Views Quick Start -- Chapter 3: How the Table View fits together -- Chapter 4: How the Collection View fits together -- Chapter 5: Feeding Data to your Tables and Collection Views -- Chapter 6: How the Table View Cell Fits Together -- Chapter 7: Improving the Look of the Table View Cells -- Chapter 8: Creating Custom Table View Cells with Subclasses -- Chapter 9: Improving the Table View Cells Interaction -- Chapter 10: Using Tables for Navigation -- Chapter 11: Indexing, Grouping, and Sorting in Table Views -- Chapter 12: Selecting and Editing Table Content -- Chapter 13: Table Views and Storyboards -- Chapter 14: Table Views on Larger Devices -- Chapter 15: Tables with WatchKit -- Chapter 16: Collection View Flow Layouts -- Chapter 17: Collection View Custom Layouts -- Chapter 18: Customizing Collection View Cells and Interactions -- Chapter 19: Collection Views and Storyboards -- Chapter 20: Advanced Collection View Custom Layouts -- Chapter 21: Advanced Topics.

Duckett: author's other books


Who wrote Pro iOS Table Views and Collection Views? Find out the surname, the name of the author of the book and a list of all author's works by series.

Pro iOS Table Views and Collection Views — read online for free the complete book (whole text) full work

Below is the text of the book, divided by pages. System saving the place of the last page read, allows you to conveniently read the book "Pro iOS Table Views and Collection Views" online for free, without having to search again every time where you left off. Put a bookmark, and you can go to the page where you finished reading at any time.

Light

Font size:

Reset

Interval:

Bookmark:

Make
Tim Duckett 2015
Tim Duckett Pro iOS Table Views and Collection Views 10.1007/978-1-4842-1242-4_1
1. Table Views Quick Start
Tim Duckett 1
(1)
SY, UK
In this chapter, youll start your exploration of table views. This chapter begins with an overview of what table views are and some examples of how theyre used in practice. Then, in the second section, youll build a simple Hello, world-style table view app to introduce you to the components behind the user interface and help you contextualize the detail that will come in later chapters.
If youre just starting to use table views, its worth taking some time to build a very simple one from scratch before diving into the gnarly details. However, if youve reached the stage where you feel more confident about how the components of the table view jigsaw fit together and want to get straight into the code, feel free to skip the rest of this chapter completely. Ill cover the elements in detail later, so you wont miss out.
What Are Table Views?
Examples of table views can be found everywhere in iOS apps. You are already familiar with simple tables, implemented as standard controls such as the iPhones Settings app or the iPads Mail app, shown in Figure .
Figure 1-1 Some basic table-based applications At the other end of the - photo 1
Figure 1-1.
Some basic table-based applications
At the other end of the scale, the default look, feel, and behavior of the table view and cells can be customized to the point where they are hardly recognizable as table views at all. Figure shows some examples.
Figure 1-2 Examples of table views in action on the iPhone The Anatomy of - photo 2
Figure 1-2.
Examples of table views in action on the iPhone
The Anatomy of a Table View
The table view displays a list of elements, also known as table view cells, that can be scrolled vertically. The table view is composed of two physical parts:
  • The container partthe tableView itselfis a subclass of UIScrollView and contains a vertically scrollable list of table cells.
  • Table cells, which can be instances of one of four standard UITableViewCell types or custom subclasses of UITableViewCell that can be customized as required.
Figure illustrates the parts of a table view.
Figure 1-3 The basic anatomy of a table view The table view cant operate on - photo 3
Figure 1-3.
The basic anatomy of a table view
The table view cant operate on its own, though; it needs the support of objects that conform to two UITableView protocols:
  • The object that conforms to the UITableViewDatasource protocol provides the table view with the data that it needs to construct and configure itself, such as the number of sections and rows. It also creates and provides the cell objects that the table view displays.
  • The object that conforms to the UITableViewDelegate protocol is responsible for handling user interaction with the table, such as selection, editing, and ordering.
A very common pattern is for the UIViewController instance that manages the view in which the table lives to also act as the data source and delegate. As youll see later in , this doesnt always have to be the case; it can help to make the architecture of your app cleaner if those functions are delivered by other classes.
Creating a Simple Table View App
In the rest of this chapter, youll build a simple Hello, world style table view app from scratch. It will show you how the container, cells, data source, and delegate all fit together and give you an app that you can use as the basis for your own experiments.
Im going to take it deliberately slowly and cover all the steps. If youre a confident Xcode driver, you wont need this hand-holdingjust concentrate on the code instead.
Still with me? Okayyoure going to do the following:
  • Create a simple, window-based application skeleton.
  • Generate some data to feed the table.
  • Create a simple table view.
  • Wire up the table views data source and delegate.
  • Implement some very simple interactivity.
Its a very straightforward but useful practice. Onward!
Creating the Application Skeleton
For this application, youre going to use a simple structure: a single view managed by a view controller, and a Storyboard file to provide the content for the view. Fire up Xcode and select the Single View Application template, as shown in Figure .
Figure 1-4 Xcodes template selection pane Note With each new release of - photo 4
Figure 1-4.
Xcodes template selection pane
Note
With each new release of Xcode, Apple frequently (and pointlessly) changes the templates that are included. You may see a set that is different from those shown in Figure . Check the description of the templates to find the one that provides a single view application.
Figure 1-5 Name the application Call the application SimpleTable Youre - photo 5
Figure 1-5.
Name the application
Call the application SimpleTable . Youre going to build an iPhone version, but you dont need Core Data or any tests.
Make sure those options are selected as needed, as shown in Figure .
Finally, you need to select where you want to save the project. You dont need to worry about creating a local Git repository for this project unless you particularly want to.
When youve reached this point, youll see the project view of Xcode, with the initial skeleton of your application. Itll look something like Figure , assuming that youve stuck with the SimpleTable application name.
Figure 1-6 The initial Xcode view showing your new skeleton application - photo 6
Figure 1-6.
The initial Xcode view showing your new skeleton application
Youll see that you have the following:
  • An app delegate ( AppDelegate.swift )
  • A view controller ( ViewController.swift )
  • A Storyboard file ( Main.storyboard )
At the end of this chapter, youll look again at how these fit together. For the moment, youll be working with the view controller and the Storyboard file.
At this point, you can run the app to verify that it compiles correctly. Go to Product Run or press Command+R and youll see the apps launch screen and an empty white view. Now youre ready to start building the table view.
Generating Some Data
Before you start with the table view itself, you need to create some data to feed it. Because this is a simple table example, the data is going to be simple too. Youll create an array of strings that contains some information to go into each cell.
The data array will need to be ready by the time the data source is called by the table view, so where to create it? There are several options, but one obvious place is in the view controllers viewDidLoad function. Its safe to create it here.
Next page
Light

Font size:

Reset

Interval:

Bookmark:

Make

Similar books «Pro iOS Table Views and Collection Views»

Look at similar books to Pro iOS Table Views and Collection Views. We have selected literature similar in name and meaning in the hope of providing readers with more options to find new, interesting, not yet read works.


Reviews about «Pro iOS Table Views and Collection Views»

Discussion, reviews of the book Pro iOS Table Views and Collection Views and just readers' own opinions. Leave your comments, write what you think about the work, its meaning or the main characters. Specify what exactly you liked and what you didn't like, and why you think so.