DPS923 MAP523 Quiz 5

Quiz 5, on Tuesday, February 17, 2015

.

The sample answers are just that – sample answers. It is not necessary to include all items in a sample answer in order to earn partial or full credit.

.

Recently, when covering the ‘add item’ pattern, you learned about the design and “protocol” coding technique for a custom modal view + controller. Briefly explain the design and technique.

1. Create the controller.
2. Add code that declares a protocol (with at least one method to handle a callback).
3. Add a delegate property to the controller; its type is the protocol type.
4. Add a scene for the new controller. Configure the scene and controller with user interface outlets and actions.
5. Add code to package the user input, and call back to the delegate method.
6. In the presenting controller, adopt the protocol, code the segue, and implement the delegate method.

.

Write a brief answer for each of the following. Each answer is worth up to ½ mark.

What is modal view?

A view that provides self-contained functionality for a task or workflow.
Appears on top of the view that triggered its appearance.

.

Briefly explain the purpose of protocol in Swift.

Names required and/or optional methods that must be implemented by adopting classes.
Enables loose coupling of classes.

.

Name and briefly describe any of the objects needed to use the network.

(any one of…)
Task – NSURLSessionDataTask – compose and send a request, handle the response.
Session – NSURLSession – logical session between your app and a web service.
Request – NSMutableURLRequest – HTTP request object, configurable

.

“Network operations are asynchronous.” What does this mean, in general, and/or for an iOS app?

We do not know if or when our request will be responded to.
Therefore, do not perform a network operation as a blocking task.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: