Download presentation
Presentation is loading. Please wait.
Published byDylan Robbins Modified over 9 years ago
1
Apple iOS 6 Overview @ Copyright Mike Stevens IT Consultant ltd
2
Sizing iPhone has 320 Width x 480 Height (portrait) coordinates iPad has 768 Width x 1024 Height (portrait) coordinates iPad is NOT simply 2 iPhones so Apps need 2 different screen layouts for iPhones / iPad Different versions of iPhone and iPad have Normal and Retina screens. iPhone 4s and iPad 3 Retina screens have twice resolution of pixels within same coordinates –NB: Retina screen can display a 1080p HD video compared to 720p Video HD on normal screen. Apple Thunderbolt screens (Intel HD graphics) are 1440 and 1440p Video HD exists Layout is defined using Left/Right and Top/Bottom Indent coordinates iPhone Centre is 25, 225, 300, 50 iPad Centre is 259, 475, 300, 50 @ Copyright Mike Stevens IT Consultant ltd
3
O/S Functionality Multi-Tasking – Foreground and Background Application in Foreground has “full” (within iOS Functionality) capability Application in Background has “limited” capability Only 1 App (including taking a phone call) can be in Foreground at ay one time App states are Initiation, Suspension, Restore and Close App has to save any data required for ongoing functionality before Suspension App has to save any data required for ongoing functionality before Close iPhone and iPad have limited memory – there is no Virtual Memory Apps should release memory as soon as it is not required. If iPhone and iPad memory becomes low then iOS will force the closing of apps Apple Apps have a higher priority for Memory Connectivity – Mobile/Cellular and Wi-Fi Apple, Telecom operators and User £ bills prefer Apps with Wi-Fi connectivity User Input – Multi-touch (more than just Keyboard), Accelerator & Gyroscope User Feedback – Screen (Text, Images, Video, Audio) and Vibrations @ Copyright Mike Stevens IT Consultant ltd
4
Application Development Can only be undertaken using Mac Computer Apps developed using Xcode Integrated Development Environment (IDE) Apps in development mode are active for 120 days Apple development license required to Publish Apps via App Store Apple development license is $100 per year Apps can be tested using MAC Simulator or “development” iPhone/iPad iPhone/iPad in “development” mode need Apple development license. Apple Objective C (was NextGen C for Unix) is Object Orientated code Cocoa Touch is the Framework set of Classes for Object creation. Model – View – Controller (MVC) is development methodology An Xcode project is a collection of app code and build settings Xcode has a number of pre-defined project types and build targets. Build targets are either iPhone, iPad or Universal (iPhone and iPad) Code has to be carefully targeted against iOS current and previous version(s) @ Copyright Mike Stevens IT Consultant ltd
5
Xcode IDE Menu Options Toolbar Build & Run OptionsCode Section MenuEditor Options View Options Navigator IconsEditor ViewerUtility Viewer Navigator Files @ Copyright Mike Stevens IT Consultant ltd
6
Symbol Elements Framework Class #Includes View Controllers Class Objects defined as (id), (void) and (IBAction) Variables Labels Actions Properties and synthesize // Reminder Notes #Pragma marks with “label name” to create app specific code sections Implementation files *.m –definitions of #imports, @Interfaces, @Properties and –IBAction's Interface files *.h –Functionality code for @interfaces, @implementations, @synthesize, -(id), -(void) –IBAction’s NB # is Alt (Option) 3 on Keyboard @ Copyright Mike Stevens IT Consultant ltd
7
Code Building / Testing Compiling - Compile code into Application Linking – Link App Code with Frameworks Target – Mac Simulator or connected iPhone / iPad Configuration – Debug (default) or Release (App Store) Errors (shown in Red) will stop Compiling process Warnings (shown in yellow) will Compile but may cause issues. Deprecated code cannot be corrected if previous iOS version are supported within App Logic Problems (shown in blue) will Compile but may cause problems Snapshots are a Copy of Code in a time period Created Manually or for each Build Can be Restored on a line by line basis Testing is within iPhone or iPad Simulator or a Development iPhone / iPad Testing is for specific iOS, e.g. iOS 6 or earlier version for regression testing @ Copyright Mike Stevens IT Consultant ltd
8
Project Properties Defined with a Info.plist file iPad / iPhone Screen Icons – Image and 8 letters –must not look like or sound like Apple icons Launch Images – if there is a lot of app start code – not a good usability idea Supported Device Orientations, e.g. Portrait, Landscape, etc, etc App does Not Run in Background, i.e. it simply closes. App uses Wi-Fi or Mobile/Cellular – not all iPADs have Mobile/Cellular capability App Help File location Minimum iOS version – Has there been any Deprecated code changes? Minimum iPhone / iPad version – are there any image detail Etc, etc iPhone 1,2,3 and 4 (normal) icons are 57 x 57 pixels iPhone 4+ (retina) icons are 114 x 114 pixels iPad 1 and 2 (normal) icons are 72 x 72 pixels iPad 3 (retina) icons are 144 x 144 pixels @ Copyright Mike Stevens IT Consultant ltd
9
Object C Object Orientated Programme (OOP) both within Code Syntax and Structure Class Header/Interface and Implementation Files for encapsulation Sub-Class imports and builds on Framework class for inheritance Object is an Active Instance of a Class with an implementation. Singleton class is only Instantiated into an object once during life of App Instance Action is code to define the specific app object functionality. Property (instance variable) is code to define Specific App Object Values –Property and Variable Name are assumed to be the same and only accessed via Property. IBAction’s call a Action using its Name Synthesize reads and set Property values using its Name Names should be meaningful. Object are utilised within Own Object (self) or by External Object Interface Name Object Variable Types are NSString, NSDate and NSURL Object Types can also be IBAction(Event), ID (Unknown) or Void (No return value) Object Screen Types are Label, Text, Button, Switch, Segmented, Sliders, etc, etc, Primitive Data Types are int (1,2.3), float (1.1, 1.2, 1.3) and double (floating point) @ Copyright Mike Stevens IT Consultant ltd
10
Coding Declare Variables with Object/Primitive Type and Name Allocating and Initialising Objects with Name, alloc and Init Use Object Type Casting for unknown Object Type Use Object Instance Code with Object Name Action Name:@ Parameter Value Use Object Handler Code Blocks for Event Actions, e.g. Button Pressed Use Object Properties for Object Instance Values Make App Functional Decisions using Expressions, e.g. Compare, >, <, etc –==: means are values equal, !=: means are values not equal –&&=: is the And condition, || is the OR condition and !: is the NOT condition –++ means add 1 to Variable number and – means reduce 1 from Variable number –If and Else branching –Switch and Case / Default branching –For (initialisation, condition, update value) looping –While (expression valid) looping Release Memory with Automatic Reference Counting / Self.Object Name:nil @ Copyright Mike Stevens IT Consultant ltd
11
Cocoa Touch Supporting Layers Cocoa Touch Media Core Services Core OS 90+ % of App functionality developed using Cocoa Touch Framework classes Each new Version of iOS adds new Cocoa Touch Framework Functionality @ Copyright Mike Stevens IT Consultant ltd
12
Cocoa Touch Supporting Layer Frameworks Cocoa TouchUIKit – for App Launch/Terminate/Multi Tasking/Touch Interface MapKit for Google (IOS 1 to 5) and Apple (IOS6) Maps GameKit for Games and Peer to Peer Networks Session & Discovery MessageUI / AddressBookUI / EventKitUI for Email Integrations Social for Social Media integrations, e.g. Twitter and Facebook iAD for inclusion of Apple managed Adverts into Apps Pass Kit for downloadable passes, e.g. coupons, boarding passes, etc Reminders for creating and accessing time and proximity alerts MediaAV for Audio Video Core Audio for Playback and Recording inc Alerts and Vibrations Core Images for Images including Video Core Graphics for 2D Drawing Core Text for Text processing Core IO for Input / Output Image Data Media Player for Movie Playback Open GL ES for 2D and 3D Animation Quartz Core for Hardware Capability Animation @ Copyright Mike Stevens IT Consultant ltd
13
Cocoa Touch Supporting Layer Frameworks Core Services User Account Data Address (Contact) Book Data CFNetwork – BSD Sockets (Winsock/TCPIP), HTTP/FTP and Bonjour Core Data – Data Model using SQLite DB Core Foundation – C Framework (not used directly by iOS) Foundation – Objective C wrapper for Core Foundation Event Kit – Access Calendar Information and Events Core Location – Latitude/Longitude GPS / Wi-Fi Core Motion – Motion Events inc Accelerometer / Gyroscope Quick Look – File Viewing including unknown download items Store Kit – Purchases within Application via Apple App Store System Config – Current Network Config and Device Availability Core OS Accelerate – Complex Calculations including Digital Signal Processing External Accessory – Interfaces via Dock Connector and Bluetooth Security – Cryptographic functions (encrypt/decrypt) inc Keychain. System – Standard Unix Functionality @ Copyright Mike Stevens IT Consultant ltd
14
UIKit Simplified Application Processing UIKit FrameworkApplication Code User Taps App Icon App Initialises into Foreground Application:didFinishLaunchingwithOptions Create View Create View Controller Create Objects within View Create Actions and Properties User Taps Screen within Event LoopHandle Event Code via View Controller User Taps Home Button App Quits Foreground Application:applicationWillResignActive App Moves to BackgroundApplication:applicationDidEnterBackground Save Data to Restart App in same state using UIStatePreservation class functionality @ Copyright Mike Stevens IT Consultant ltd
15
Core Cocoa Touch Application Classes CoreNSObjectAllocation and Initialisation UIApplicationEvents & Configuration UIWindowManagement & Display of Views Is a Single Instance of an Object within Application Automatically Created by iOS UIViewDefines Display of Objects within a Specific View Part of a Hierarchy of Views within UIWindow Main View and then Sub Views connected via Segues UIViewControllerManagement of Views and Implementation of Events. UIControlsControls within Views, e.g. Text, Label and Buttons Use of Control triggers an Event with an Action Interface. UIResponderUser Touch Responses to UIControls with Events. A First Responder is for the Control that Triggers the Action @ Copyright Mike Stevens IT Consultant ltd
16
Core Cocoa Touch Application Classes Data TypesClass Property NSString (static) or NSMutableString (can be changed) NSArray or NSMutableArray - uses Numeric Index number NSDictionairy or NSMutableDictionairy – uses key pairs NSNumber or NSDecimalNumber NSDate with comparison functions, e.g. earlier date NSURL is a String plus String lookup functions, e.g. host URL NSData (static) and NSMutableData for distributed objects NSError with Property values indication error details User ControlsClass Objects UILabel, UITextField (single row), UITextView (multiple rows), UIPickers, UISwitch, UIButton, UISegmentedControl, UISlider, UIStepper and UIPopOverController (iPad only) @ Copyright Mike Stevens IT Consultant ltd
17
Cocoa Touch Application Project Templates Master-DetailiPad OnlyNavigation Controller and Split View OpenGL GameiPhone / iPadOpenGL ES-based Game View, Scene and Timer Page-BasediPhone / iPadPage View Controller Single ViewiPhone / iPadView Controller, Scene, Storyboard and View. TabbediPhone / iPadTab Bar Controller and View Controller for Tab Bar it UtilityiPhone / iPadMain & Alternative View with Info button to flip Views @ Copyright Mike Stevens IT Consultant ltd
18
Cocoa Touch Storyboards and Views StoryboardsXML Files containing Scene(s) Different for iPhone and iPad Scene(s) SceneDefines Each Scene within Storyboard Each Storyboard can 1 or more Scene View ControllerEach Scene has a View Controller which connects Screen Control Objects with Actions and Properties within Implementation files *.m and Interface files *.h. There is 1 View Controller for a Scene ViewContains View Objects There is 1 View for a View Controller First ResponderDefines Current User Control Objects SegueLinks Views to Views via User Control Objects UtilitiesInspectors and Library functionality within Utility Viewer part of IDE InspectorsAllows values to be set within IDE for Files, Identity, Inspector, Attributes, Size and Connections within Storyboard LibrariesAllows values to be set within IDE for File, Code, Object and Media. @ Copyright Mike Stevens IT Consultant ltd
19
Universal App (iPhone and iPad) in Single App @ Copyright Mike Stevens IT Consultant ltd Option 1 (Default) Different Storyboards for iPhone and iPadModel View Controller – View Different View Controllers for iPhone and iPadModel View Controller – Controller Distinct Classes for iPhone and iPad specific functionalityModel View Controller – Controller Common Classes for iPhone/iPad common functionalityModel View Controller – Model Use UIDeviceCurrentDevice.model to determine of iPhone or iPadModel View Controller – Controller Option 2Use Targets to Build for iPhone or iPad as 2 separate AppsProject Build Settings
20
Creating Project & View Layouts ProjectMenu Options: File, New Project, Application Template Type, e.g. Master/Detail or Single View (which is also used for multiple views) and Name Details (use Main for Class prefixes) StoryboardsMenu Options: File, New, File, User Interface, Storyboard. Must have Different Storyboards for iPhone and iPad Single Click on Storyboard file in IDE Navigator to display Canvas. Objects LibraryTo Display View Controller, Label, Text, etc within IDE Utilities Identity Inspector use Menu Options: View, Utilities, Show Object Library. SceneDrag View Controller from Object Library to Canvas to create View Controller Scene (with View and First Responder) and Implementation and Interface files. Set meaningful Custom Class Name e.g. Main or Add_ItemDetail. Add another View Controller for multiple View layouts onto Canvas. User ControlsDrag Text, Label, Button, etc from Object Library to View. Double Click on Object to add meaningful text. Layout View using Menu Options: Editor, Align and shown options SegueCtrl Drag from appropriate User Control Object (e.g. Button) within Starting View to New View and Select Type: Push, Modal or Custom @ Copyright Mike Stevens IT Consultant ltd
21
Creating Code Functionality Objects LibraryTo Display View Controller Interface File (.h) within IDE alongside Storyboard Canvas use Menu Options: View, Assistant Editor and Show Assistant Editor Select correct View Controller Interface.h file with single click PropertiesCtrl Drag from appropriate User Control Object (e.g. Labels and Text) within View to the correct View Controller's interface.h file below to @interface to create @property IBOutlet connection Set options as Connection: Outlet, Name: Meaningful Name, Type: Object Type and Storage: Strong ActionsCtrl Drag from appropriate User Control Object (e.g. Button) within View to the correct View Controller's interface.h file to create -(IBAction) connections Set options as Connection: Action, Name: Meaningful Name, Type: ID, Event: Touch Up Inside (button touched) and Arguments: Sender SynthesizeSelect correct View Controller Implementation.m file with single click Manually add @synthesize code for each property created above. FunctionalityManually add required functional code to –(IBAction) for the appropriate User Control object within correct View Controller Implementation.m file @ Copyright Mike Stevens IT Consultant ltd
22
Model, View and Controller (MVC) ModelShared Business Functionality using Named Delegate Handler Code Blocks NB: By default functionality is within each View Controller (referenced via self) This depends on the complexity of application functionality. Where the Core Data Model using SQLite DB is used. ViewStoryboard Views with User Control Objects for Presentation to User ControllerView Controller with Interface Outlet Properties and Event Method Actions @ Copyright Mike Stevens IT Consultant ltd View display the Presentation Layer (iPhone / iPad screen) to User. User Actions within View are implemented via Controller Interface Properties and Actions code. The Controller implements the Business Functionality via Local (self) or Shared Model Interface code. The Model (or Local) code returns the results of the Business Functionality to Controller. Controller returns the results of the Business Functionality as Presentation changes to View. View changes Presentation to User.
23
Application Data PreferencesApplication Preferences with Default Values User Preference Settings within App Settings within Apple Settings App User Defaults are configured as Setting Bundles as Singleton Key/Value Pairs Setting Bundles are added to Project as a Root.plist Resource File User Default values saved in Default DB which is part of iTunes/iCloud Backup Values accessed via NSUserDefaults standardUserDefaults Changed values (from defaults) are saved via NSUserDefaults Synchronize App ValuesSaved into Directory as File Values or into Core Model using SQLite DB Application can only access data within its own Application Directory Files are accessed via NSFileManager and NSFileHandler For Security reasons there is NO Application to Application Directory Access NB: This is not a technical restriction but an Apple policy. If you do not follow policy then the app will not be approved for Apple App Store !!!!! User will be asked for any integrations with Contacts, Calendar, Reminders or Photos App Directories are Library/Preferences, Library/Cache, Documents and Tmp File space (like Memory) is limited so should be kept to a minimum at all times. Directory Path is identified using NSSearchPathForDirectoryinDomain @ Copyright Mike Stevens IT Consultant ltd
24
Orientation and Accelerator Impacts @ Copyright Mike Stevens IT Consultant ltd App should support Orientation, Rotation, Portrait, Landscape and Upside down layouts If App does not support these layouts then this need to be defined within app config Use shouldAutoRotatetoInterfaceOrientation(parameter) = True/False Parameters are Portrait, Portrait Upside Down, Landscape Left and Landscape Right. Landscape and Portrait have same Area but need different View layouts Options are: –Use 2 Different Views with Common/Model Block Code Actions –Use Core Graphics CGRectMake to reset coordinates for a Single View User Controls –Use IDE Size Inspector to resize View User Controls using Horizontal/Vertical Anchors. App may support (if required) Accelerator (Movement and Tilt) iOS capability Amount of use of Accelerator is defined using X and Y axis values App has to be set to receive X/Y value notifications using UIDevice NSNotificationCentre App receive notifications via CoreMotion CMMotionManager Handler Code Block
25
Address Book (Contact) and Email Integration @ Copyright Mike Stevens IT Consultant ltd Address Book is a central set of Contacts for all apps –Apple policy is not to create a separate list within an App Integrate using AddressBook and AddressBookUI frameworks AddressBookUI provides Browse, Search, Select, Edit and Create New functionality –iPhone display a model view and iPad displays a Master-Detail view or a Custom Code view Use ABPeoplePickerNavigationController class Class requires Delegate Handler Code Blocks: –ABPeoplePickerNavigationControllerDelegate didCancel –ABPeoplePickerNavigationControllerDelegate shouldContinueAfterSelectingPerson Email Integration uses Default Email defined in Apple iOS Settings Use MFMailComposerViewController Add Text Value(s) for Email Address(s) using setToRecipientsArray method Display View with presentModelViewController method Class requires Delegate Handler Code Block for didFinishWithResult
26
SOAP Web Service Integration @ Copyright Mike Stevens IT Consultant ltd Use NSURL Define XML SOAP String within an NSString Create a Soap Envelope within NSData using XML SOAP String Define Web Service URL within an NSString Create a HTTP Soap Request within an NSMutableURLRequest using Web Service URL Define SOAP Function Name within an NSString, e.g. domain name/function Add to HTTP Soap Request the SOAP Function Name as a SOAP Action Add to HTTP Soap Request the HTTP Method, e.g. Post Add to HTTP SOAP Request the HTTP Body, e.g. Envelope Add to HTTP SOAP Request the Charset and Content-Type Add to HTTP SOAP Request the Envelope and Content lengths Make Network TCPIP connection using NSURLConnection class Class Requires Delegate Handler Code Block for Connection results: –didReceiveConnection to utilise NSURLResponse –didReceiveData to utilise NSData value within NSURLResponse –didFailWithError to utilise NSError values –connectionDidFinishLoading to utilise NSString XML Values within NSURLResponse
27
More details can be obtained from Apple https://developer.apple.com/devcenter/ios/index.action https://developer.apple.com/library/prerelease/ios/#documentation/Miscellaneous/Con ceptual/iPhoneOSTechOverview/Introduction/Introduction.html#//apple_ref/doc/uid/TP 40007898https://developer.apple.com/library/prerelease/ios/#documentation/Miscellaneous/Con ceptual/iPhoneOSTechOverview/Introduction/Introduction.html#//apple_ref/doc/uid/TP 40007898 https://developer.apple.com/library/prerelease/ios/#documentation/UserExperience/C onceptual/MobileHIG/Introduction/Introduction.html#//apple_ref/doc/uid/TP40006556https://developer.apple.com/library/prerelease/ios/#documentation/UserExperience/C onceptual/MobileHIG/Introduction/Introduction.html#//apple_ref/doc/uid/TP40006556 https://developer.apple.com/library/prerelease/ios/#documentation/iPhone/Conceptual /iPhoneOSProgrammingGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP4 0007072https://developer.apple.com/library/prerelease/ios/#documentation/iPhone/Conceptual /iPhoneOSProgrammingGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP4 0007072 @ Copyright Mike Stevens IT Consultant ltd
28
Thanks http://www.mikestevensitweb.com @ Copyright Mike Stevens IT Consultant ltd Mike Stevens IT Consultant 0777 566 3713
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.