IPhone Program Development graphics and animation Getting Started Guide

Source: Internet
Author: User

IPhoneProgram DevelopmentGraphicsAndAnimationThe Getting Started Guide is the content to be introduced in this article. If you don't talk about it, go to the topic,IPhoneOS has several frameworks to process graphics and animations:

§UIKitIt contains a library for the C language class, which provides user interface operations and 2D drawing. You can also useUIKitTo make the user interface active

§ Core Graphics is an API application interface based on C Language) used to draw vector Graphics, bitmaps, and PDF directories. Note that Quartz 2D is a specialized term for the 2D painting engine, and Core Graphics is the name of the framework. These two terms are generally used as the same word .)

§ Core Animation C language-oriented API adds smooth motion and dynamic feedback to the user interface

§ OpenGL ES is an OpenGL mobile phone version used for high-quality 2D and 3D drawing on mobile devices. It is a subset of OpenGL APIs on the desktop and takes into account the closeness and effectiveness during design. The OpenGL ES framework contains EAGL, C-Based APIS, and integrates OpenGL ES into the Core Animation layer and UIKit view.

You can use UIKit on your user interface to perform typical graphic operations, such as drawing a graphic column, setting colors, and filling a matrix. It also refers to the tool you use to transfer, move, zoom, rotate) One view or screen) flat to another, and create a vivid directory in your view or hierarchy.

Use the Core Graphics framework when you need more powerful 2D rendering capabilities. It is a rough process for drawing vector images, lines, shapes, modes, slopes, images, and even PDF files. Core Graphics can be used for higher-level framework columns such as UIKit.

Core Animation is a programming interface. The UIKit framework uses it to implement class hierarchy and conversion. Most of the time, you may not need to use Core Animation directly. It is used only when your application needs to perform detailed operations on the animation.

When using OpenGL ES, you may need GPU-provided advanced graphics processors to develop games or other applications.

Basic Conditions

To better understand the basics of the iPhone OS drawing project, read the following sections of the iPhone Application Programming Guide:

§ Read "Windows and Views" to learn about view levels, iPhone OS built-in coordinate systems, and operations on Views ".

§ Read "Graphics and Drawing" to learn about the concepts and terminologies of Graphics and animation ".

To support images and animations on your iPhone application, you need to decide which border to use based on your specific needs. Carefully study the template programs that use those frameworks to understand how different frameworks combine functions and methods to create a runable application.

Select a suitable framework

Generally, you should use the highest framework to meet your application needs. The lower-layer framework is used only when you need more precise operations and more powerful functions.

If you plan to layer the 2D directory, use the UIView class of the UIKit framework. The UIView class is built on the Core Animation layer. On the iPhone OS, it is much easier to use views to layer layers than to use Core Animation layers.

If you want to vividly stratify directories or views, use simple animations and Core Animation in the UIKit framework for more precise control.

If you want to display the image, use the UIImage and UIImageView class provided by the UIKit framework.

If you want to draw a specific, vector image, use the Core Graphics framework and UIView class provided by the UIKit framework.

If you want to create a game, a 3D directory, or an application with GPU graphics capabilities, use the OpenGL ES framework, the CAEAGLLayer class of Core Animation, and the UIView class of UIKit.
 
For more information about the classes of the UIKit Framework, see the UIKit Framework Reference. For more information about the Core Graphics and OpenGL ES frameworks, see Core Graphics Framework Reference and OpenGL ES Framework Reference. To learn how to insert an animation into a program, see "Graphics and Drawing" in the iPhone Application Programming Guide ".

Draw a hierarchical directory

To learn how to draw a hierarchical directory, you must be familiar with the UIView Class Reference, especially its management view hierarchy.

Next, open the metemedime sample program in Xcode. Note that the setupSubviews class describes how to create a secondary view in the metemedimeview. m file.

Animation

To get to know the animation directory in your app, read "Animating Views" in the iPhone Application Programming Guide to learn about the attributes you can use to make animations. Then you can refer to "Applying Core Animation Effects" in the iPhone Application Programming Guide ".

Next, open the MoveMe sample program in Xcode. Carefully read the MoveMeView. m file that contains several animation view editing methods, and the following two methods: animateFirstTouchAtPoint: And growAnimationDidStop: finished: context demonstrate how to use the UIView class to make the view vivid. AnimatePlacardViewToCenter demonstrates how to use Core Animation to build the main frame Animation.

For a deeper understanding of Animation production, see Core Animation Programming Guide.

Clever use of images

If you want to use images in your application, you may be interested in UIImageView Class Reference and UIImage Class Reference. If you want users to scale images, you also need to be familiar with UIScrollView Class Reference andUIScrollViewDelegate Protocol Reference.

Create a custom 2D directory

To learn how to draw a 2D directory, read "Drawing With Quartz and UI Kit" in the iPhone Application Programming Guide ". Next, let's look at CGContext Reference, which describes most of the plotting functions you will use.

Next, let's look at the sample code Finger Sketch in Xcode. You will realize how to build Core Graphics and execute drawRect: both the method and the Directory are implemented based on user operations.

For more information about drawing, see Overview of Quartz 2D. To learn how to perform a specific drawing task, such as creating a pattern, path, or slope, read the appropriate section in the Quartz 2D Programming Guide.
 
Drawing through OpenGL ES

Want to learn and useOpenGLES for plotting. Read the OpenGL ES Overview provided by the Khronos Industry Association, which retains details about OpenGL ES.

Next, check the GLSprite sample code in Xcode. You will see how to create a framework buffer for the OpenGL ES directory in the EAGLView. m file.

ToIPhoneMake full useOpenGLElasticsearchOpenGLES Programming Guide for iPhone OS.

Summary:IPhoneProgram DevelopmentGraphicsAndAnimationThe content of the Getting Started Guide is complete. I hope this article will help you.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.