9. CORE OS
iOS is a Mac OS X which is a UNIX - like system
Cocoa Touch
Security FW Accelerate FW
Media External Accessory FW
System
• Threading (POSIX threads)
Core Services •
•
Networking (BSD sockets)
File-system access
• Standard I/O
• Bonjour and DNS services
• Locale information
• Memory allocation
Core OS
Thursday, December 15, 11
10. CORE SERVICES
Cocoa Touch Threading High-Level
Features
File Access • ARC (Automatic
Reference Counting)
Media •
•
iCloud
GCD(Grand Central
Preferences •
Dispatch)
In-App Purchase
• SQLite
Core Services Collections Networking
• NSArray
• NSDictionary
• NSSet
Core OS Address Book
Thursday, December 15, 11
11. MEDIA LAYER
Cocoa Touch Core Audio Core Animation
AirPlay Audio Recording
Media
Quartz (2D) Audio Mixing
Core Services Video Playback OpenAL
JPEG, PNG, TIFF PDF
Core OS
Thursday, December 15, 11
12. COCOA TOUCH
Cocoa Touch Map Kit
High-Level Features
iAd • Push Notifications
• Storyboard
Media •
•
Local Notifications
Printing
Game Kit • Gesture Recognition
• File Sharing
Core Services Events (Touch)
View Controllers UIKit
Core OS
Thursday, December 15, 11
13. MVC - MODEL VIEW
CONTROLLER
Как да се изобрази
Controller
Определя поведението
Променя модела
Определя кое View получава touches
Описание Изобразяване
Model View
Запазва състоянието на апликацията Изпраща действията на потребителя към controller
Показва функционалността Изисква промяна на модела
Съобщава на View за промени Изобразява модела /render/
Thursday, December 15, 11
14. MVC - MODEL VIEW
CONTROLLER
Controller
Model View
Thursday, December 15, 11
15. MVC - MODEL VIEW
CONTROLLER
Notification / KVO
Controller
De
leg
O ate
ut
let
Notify
Model View
Thursday, December 15, 11
16. CHAPTER 2
APPLICATION EVENTS
Core App Objects
Figure 2-1 Key objects in an iOS app
Model
Data Objects Document
Controller View
UIApplication Application Delegate UIWindow
Event Data Model Objects Data Model Objects
Data Model Objects Data Model Objects
Loop View Controller Views and UI Objects
Custom Objects
System Objects
Either system or custom objects
Table 2-1 The role of objects in an iOS app
Thursday, December 15, 11
19. OBJECTIVE C
• Комбинация межди C & Smaltalk
• Superset на С
• Компилира С и С++ класове
• NeXTSTEP (NS)
• Apple
• Objective C
Thursday, December 15, 11
21. THE APP LAUNCH CYCLE
CHAPTER 3
App States and Multitasking
Foreground
Figure 3-2 Launching an app into the foreground
Launch Time Your code
User taps app icon
main()
UIApplicationMain()
Load main UI file
application:
Initialize the app
didFinishLaunchingWithOptions:
Foreground
Activate the app applicationDidBecomeActive:
Event
Handle events
Loop
Switch to a different app
Thursday, December 15, 11
22. 51).
Suspended The app is in the background but is not
automatically and does not notify them
APPLICATION STATES
in memory but does not execute any c
When a low-‐memory condition occurs, t
to make more space for the foreground
Figure 3-1 State changes in an iOS app
Not running
Foreground
Inactive
Active
Background
Background
Suspended
Thursday, December 15, 11
23. RUN LOOP
main.m
• вход към програмата
Thursday, December 15, 11
24. .H ( HEADER FILE)
AppDelegate.h
• публични методи
• публични променливи
Thursday, December 15, 11
26. ВИВОДЕ МЕТОДИ
• instance
• class
Thursday, December 15, 11
27. ОСНОВЕН ОБЕКТ
NSObject
•- (id)init;
•+ (id)alloc;
•- (void)dealloc;
•- (id)copy;
Thursday, December 15, 11
28. MEMORY MANAGEMENT
• retain
• release
• вески обект, който притежаваме трябва да бъде
освободен, когато свършим работата си с него
Thursday, December 15, 11
29. APPLICATION SANDBOX APPENDIX A
The iOS Environment
Figure A-1 Sandbox directories in iOS
App Sandbox
MyApp.app
Documents
App
• собствени файлове ...
Library
tmp
• няма ...
достъм по чужди
App Sandbox
• сигурност App ...
App Sandbox
App ...
Important: The purpose of a sandbox is to limit the damage that a compromi
Thursday, December 15, 11 system. Sandboxes do not prevent attacks from happening to a particular app a
33. for iOS.
Figure 2-‐3 shows the basic structure of an app whose interface is constructed solely using view objects. In
BUILDING AN INTERFACE USING UIKIT
this instance, the main view spans the visible area of the window (minus the scroll bar) and provides a simple
white background. The main view also contains three subviews: an image view, a text view, and a button.
VIEWS
Those subviews are what the app uses to present content to the user and respond to interactions. All of the
views in the hierarchy are managed by a single view controller object.
Figure 2-3 Building your interface using view objects
View Controller
Application controller layer
View layer
Window View
Image View Text View Button
In a typical view-‐based app, you coordinate the onscreen views using your view controller objects. An app
always has one view controller that is responsible for presenting all of the content on the screen. That view
controller has a content view, which itself may contain other views. Some view controllers can also act as
Thursday, December 15, 11 containers for content provided by other view controllers. For example, a split view controller displays the
34. СТРУКТУРИ
• CGPoint
• CGSize
• CGRect = CGPoint, CGRect
Thursday, December 15, 11