Start Developing iOS Apps Today をやってみる その1
#rebuildfm ep. 39 聴いてStart Developing iOS Apps Todayというto-do listのiOS アプリのチュートリアルをやることにしたのでメモ。
Tutorial: Basics
画像の通りサクサクやっていけばHello, World!が出せる
App Development Process
Defining the Concept
コンセプトの定義について
Here are some key questions to consider when arriving at a concept:
Who is your audience? Your app content and experience will differ depending on whether you’re writing a children’s game, a to-do list app, or even a test app for your own learning.
What is the purpose of your app? It’s important for an app to have a clearly defined purpose. Part of defining the purpose is understanding what one thing will motivate users to use your app.
What problem is your app trying to solve? An app should solve a single problem well instead of trying to offer solutions to multiple distinct problems. If you find that your app is trying to solve unrelated problems, you might consider writing multiple apps.
What content will your app incorporate? Consider what type of content your app will present to users and how they’ll interact with it. Design the user interface to complement the type of content that’s presented in the app.
An app concept doesn’t have to be completely polished or finished when you start developing your app. Still, it helps to have an idea of where you’re going and what you need to do to get there.
Implementing the Behavior
Classes Are Blueprints for Objects
allocate と initializeの目的 メモリを用意して、初期化
You make an object by creating an instance of a particular class. You do this by allocating it and initializing it with acceptable default values. When you allocate an object, you set aside enough memory for the object and set all instance variables to zero. Initialization sets an object’s initial state—that is, its instance variables and properties—to reasonable values and then returns the object. The purpose of initialization is to return a usable object. You need to both allocate and initialize an object to be able to use it.
Objects Communicate Through Messages
メッセージを投げる
If you have an object
somePerson
of classXYZPerson
, you can send it thesayHello
message like this:[somePerson sayHello];
The reference on the left, somePerson, is the receiver of the message. The message on the right, sayHello, is the name of the method to call on that receiver. In other words, when the above line of code is executed, somePerson will be sent the sayHello message.
https://developer.apple.com/library/iOS/referencelibrary/GettingStarted/RoadMapiOS/Art/programflow1_2x.png
somePersonはsayHello(somePersonのmethod)というメッセージを投げられる
Designing a User Interface
The View Hierarchy
Views not only display themselves onscreen and react to user input, they also serve as containers for other views.
viewは自身をスクリーンに表示したり、ユーザの入力に反応したりするだけでなく、他のviewの入れ物にもなる
At the top of the view hierarchy is the window object. Represented by an instance of the UIWindow class, a window serves as the basic container into which you can add your view objects for display onscreen.
一番上の階層はUIWindow
今回はここまで