From: http://www.guomii.com/posts/23898
Framework:
Each application is composed of two parts: one is the code you write, and the other is the framework provided by Apple ). The Framework contains the repository that can be called by your application. A framework can be accessed by multiple applications at the same time.
Any application you develop will be connected to multiple frameworks. You can use the application programming interface (API) provided by the framework. APIs are declared in header files, specifying available objects, classes, data structures, and protocols. The framework written by Apple estimates the basic functions you may need to implement in advance. By using the framework, you can save time and energy and ensure code efficiency and stability. Only the system framework can access the underlying hardware.
Main framework Overview:
The framework itself is a folder containing public library files, header files used to access these libraries, and other image and sound resource files. The Public Library defines the functions and methods that can be called by the application.
In your development process, you can use the many frameworks provided by IOs, and add the framework to the project so that your application can link it. Most applications are linked to the foundation, uikit, and core graphics frameworks. Different application templates may contain other frameworks. If the default core framework cannot meet your development needs, you can add another framework to your project at any time.
How to view the frameworks included in the helloworld. xcodeproj project...
- Open the helloworld. xcodeproj project in xcode (if not ). You have created this project in the previous "your first iOS app" tutorial.
- Open the frameworks folder in the project navigation bar, and click the triangle on the left to expand it.
You can see three frameworks: uikit. Framework, foundation. Framework, and CoreGraphics. framework.
- Click the triangle on the left of each frame to expand the frame, and then click the triangle on the left of the headers folder to view the header file.
Each Framework belongs to a level of the IOS system. Each level is built on the level below it. Use a high-level framework whenever possible to avoid using a low-level framework. A higher-level framework provides object-oriented abstraction for low-level structures.
The IOS application is based on the foundation and uikit framework.
When you start programming, you mainly use the foundation and uikit frameworks, which can cover most of your development needs.
The foundation framework provides basic system services for all applications
Whether your application or the uikit framework or many other frameworks are built on the foundation framework infrastructure. The foundation framework provides objective-C encapsulation for many features of the core foundation framework.
The foundation framework can be used:
- Create and manage groups, such as arrays and dictionaries.
- Access the images and other resource files stored in your application.
- Create and manage strings.
- Send and observe notifications.
- Create Date and Time object.
- Automatically discovers devices on the IP network.
- Operation URL stream.
- Asynchronous code execution.
In your first iOS app tutorial, you used the foundation framework. For example, you use an nsstring class instance to store the text entered by the user in username. You also use the foundation instance method initwithformat: to create a welcome word string.
The uikit framework provides a class for creating a touch interface.
All IOS applications are based on the uikit framework, and your applications cannot run without it. Uikit provides an infrastructure for drawing pictures, processing events, and creating common user interface elements. Uikit also manages the content to be displayed on the screen to organize complex applications.
The uikit framework can be used:
- Create and manage user interfaces.
- Handles touch and Action events.
- Displays text and webpage content.
- Optimize Your applications for multiple tasks.
- Create Custom User interface elements.
In your first iOS app tutorial, you used the uikit framework. When checking how the application is started, you can see that the uiapplicationmain function creates a uiapplication class instance, which will process the received user operation events. You have implemented the Protocol so that you can click the done button to collapse the keyboard. In fact, you have used the uitextfield, uilabel, and uibutton classes to create the entire user interface.
Uikit.
You should also understand several other important frameworks
Core data, core graphics, core animation, and OpenGL ES frameworks are all very advanced technologies. Although these frameworks are important to your applications, you still need to learn to master them.
Core data framework manages data models of applications
Core data provides object graph management. You can use core data to create model objects, also called managed objects. This framework is used to manage the relationships between these objects and change the data. Core Data has the advantage of using the built-in SQLite technology to store and manage data.
The core data framework can be used:
- Save and retrieve objects in the memory.
- Supports basic Undo/Redo operations.
- The property value is automatically verified.
- Filter, group, and organize memory data.
- Use [nsfetchedresultscontroller] to manage the results of the table view.
- Supports document-based applications.
Core graphics framework helps you create images
For IOS apps, high-quality graphics are crucial. The simplest and most effective way to create a graph in IOS is to use the standard view and control resources of the pre-rendered uikit framework and let IOS draw the image on its own. If you need to create complex graphics, core graphics also provides you with the underlying graphics library. Core graphics, also known as quartz, can process native two-dimensional (2D) vector images and image-based rendering.
The core graphics framework can be used:
- Draw a path-based image.
- Perform anti-sawtooth rendering.
- Add gradient fill, image, and color.
- Use coordinate space transformation.
- Create, display, and analyze PDF documents.
Core animation allows you to make advanced animations and visual effects.
Uikit provides animation effects based on core animation technology. If you need more advanced animations than the built-in effects of uikit, you can directly use core animation. The core animation interface is in the quartz core framework. With core animation, you can create a composite layer object and perform operations, rotation, scaling, deformation, and so on. In addition, you can use common view abstraction in core animation to create dynamic user interfaces without using underlying graphical APIs such as OpenGL.
Es.
The core animation framework can be used:
- Create a custom animation.
- Add time control to the animation.
- Supports key frame animation.
- Restrict the ratio of the graphic layout.
- Change multiple layers to atomic update.
OpenGL ES framework provides 2D and 3D drawing tools
OpenGL ES supports basic 2D and 3D plotting. The OpenGL ES standard developed by Apple works closely with the hardware of the device and can be used to create full-screen game applications with High Frame rates.
The OpenGL ES framework can be used:
- Create 2D and 3D images.
- Create more complex graphics, such as data visualization, flight simulation, or video games.
- Access the underlying graphic hardware.
Add other frameworks you need to the Project
You can use many frameworks in application development. When you decide to use a framework that is not included in the project, you need to add the framework to your project so that the application can be linked to the framework.
How to link the helloworld. xcodeproj project to other frameworks...
- Open the helloworld. xcodeproj project in xcode (if not ).
- In the project navigation bar, click the helloworld project to display it in the project editor.
- In the targets List, click helloworld to specify the target of the framework you want to add.
- Click the build phases tab at the top of the Project editor.
- Open the link binary with libraries block, and click the triangle on the left to expand it.
- Click the Add button (+ ).
- In the pop-up list, select a framework and click Add to add the framework.
To view the complete list of frameworks and learn about these frameworks, read the IOS technology overview document.