background preloader


Facebook Twitter

MOOC programmation sur iPhone et iPad — partie I (questionnaire de début de MOOC) About Objective-C. Objective-C is the primary programming language you use when writing software for OS X and iOS.

About Objective-C

It’s a superset of the C programming language and provides object-oriented capabilities and a dynamic runtime. Objective-C inherits the syntax, primitive types, and flow control statements of C and adds syntax for defining classes and methods. It also adds language-level support for object graph management and object literals while providing dynamic typing and binding, deferring many responsibilities until runtime. At a Glance This document introduces the Objective-C language and offers extensive examples of its use. An App Is Built from a Network of Objects When building apps for OS X or iOS, you’ll spend most of your time working with objects. If you’re writing your own class, start by providing a description of the class that details the intended public interface to instances of the class.

Categories Extend Existing Classes Protocols Define Messaging Contracts Blocks Simplify Common Tasks. Start Developing iOS Apps Today: Tutorial: Storyboards. This tutorial builds on the project you created in the first tutorial (Tutorial: Basics).

Start Developing iOS Apps Today: Tutorial: Storyboards

You’ll put to use what you learned about views, view controllers, actions, and navigation. Following the interface-first design process, you’ll also create some of the key user interface flows for your ToDoList app and add behavior to the scene you’ve already created. This tutorial teaches you how to: Adopt Auto Layout to add flexibility to your user interface Use storyboards to define app content and flow Manage multiple view controllers Add actions to elements in your user interface After you complete all the steps in this tutorial, you’ll have an app that looks something like this: Adopt Auto Layout The add-to-do-item scene is configured to work in portrait mode because that’s how you created it. To rotate in iOS Simulator Launch your app in iOS Simulator. As you see, the text field doesn’t look quite right. Setting these constraints can easily be accomplished in Interface Builder.

Swift - Resources. Cocoa Touch Layer. The Cocoa Touch layer contains key frameworks for building iOS apps.

Cocoa Touch Layer

These frameworks define the appearance of your app. They also provide the basic app infrastructure and support for key technologies such as multitasking, touch-based input, push notifications, and many high-level system services. iOS Human Interface Guidelines: Designing for iOS. The App Life Cycle. Apps are a sophisticated interplay between your custom code and the system frameworks.

The App Life Cycle

The system frameworks provide the basic infrastructure that all apps need to run, and you provide the code required to customize that infrastructure and give the app the look and feel you want. To do that effectively, it helps to understand a little bit about the iOS infrastructure and how it works. iOS frameworks rely on design patterns such as model-view-controller and delegation in their implementation.

Understanding those design patterns is crucial to the successful creation of an app. Inter-App Communication. If your app can receive specially formatted URLs, you should register the corresponding URL schemes with the system.

Inter-App Communication

Apps often use custom URL schemes to vend services to other apps. For example, the Maps app supports URLs for displaying specific map locations. Handling URL Requests An app that has its own custom URL scheme must be able to handle URLs passed to it. All URLs are passed to your app delegate, either at launch time or while your app is running or in the background. URL Scheme Reference: About Apple URL Schemes. This document describes several URL schemes that are supported by system apps on iOS and OS X.

URL Scheme Reference: About Apple URL Schemes

Native iOS apps and web apps running in Safari on any platform can use these schemes to integrate with system apps and provide a more seamless experience for the user. For example, if your iOS app displays telephone numbers, you could use an appropriate URL to launch the Phone app whenever someone taps one of those numbers. About the iOS Technologies. iOS is the operating system that runs on iPad, iPhone, and iPod touch devices.

About the iOS Technologies

The operating system manages the device hardware and provides the technologies required to implement native apps. The operating system also ships with various system apps, such as Phone, Mail, and Safari, that provide standard system services to the user. The iOS Software Development Kit (SDK) contains the tools and interfaces needed to develop, install, run, and test native apps that appear on an iOS device’s Home screen. Native apps are built using the iOS system frameworks and Objective-C language and run directly on iOS. Unlike web apps, native apps are installed physically on a device and are therefore always available to the user, even when the device is in Airplane mode. At a Glance. Cocoa Touch Layer. The Cocoa Touch layer contains key frameworks for building iOS apps.

Cocoa Touch Layer

These frameworks define the appearance of your app. They also provide the basic app infrastructure and support for key technologies such as multitasking, touch-based input, push notifications, and many high-level system services. When designing your apps, you should investigate the technologies in this layer first to see if they meet your needs. High-Level Features. Media Layer. Core OS Layer. The Core OS layer contains the low-level features that most other technologies are built upon.

Core OS Layer

Even if you do not use these technologies directly in your apps, they are most likely being used by other frameworks. And in situations where you need to explicitly deal with security or communicating with an external hardware accessory, you do so using the frameworks in this layer. Accelerate Framework The Accelerate framework (Accelerate.framework) contains interfaces for performing digital signal processing (DSP), linear algebra, and image-processing calculations. The advantage of using this framework over writing your own versions of these interfaces is that they are optimized for all of the hardware configurations present in iOS devices. For more information about the functions of the Accelerate framework, see Accelerate Framework Reference.

Core Bluetooth Framework External Accessory Framework For more information about how to use this framework, see External Accessory Programming Topics. Strategies for Handling App State Transitions. For each of the possible runtime states of an app, the system has different expectations while your app is in that state.

Strategies for Handling App State Transitions

When state transitions occur, the system notifies the app object, which in turn notifies its app delegate. You can use the state transition methods of the UIApplicationDelegate protocol to detect these state changes and respond appropriately. For example, when transitioning from the foreground to the background, you might write out any unsaved data and stop any ongoing tasks. Core Services Layer. The Core Services layer contains fundamental system services for apps. Key among these services are the Core Foundation and Foundation frameworks, which define the basic types that all apps use. This layer also contains individual technologies to support features such as location, iCloud, social media, and networking.