没有合适的资源?快使用搜索试试~ 我知道了~
iphone开发指南
需积分: 0 34 下载量 24 浏览量
2010-01-11
16:12:57
上传
评论
收藏 7.39MB PDF 举报
温馨提示
试读
164页
介绍iphone开发的相关知识,初学者必备
资源推荐
资源详情
资源评论
iPhone Application Programming Guide
General
2009-01-06
Apple Inc.
© 2009 Apple Inc.
All rights reserved.
No part of this publication may be reproduced,
stored in a retrieval system, or transmitted, in
any form or by any means, mechanical,
electronic, photocopying, recording, or
otherwise, without prior written permission of
Apple Inc., with the following exceptions: Any
person is hereby authorized to store
documentation on a single computer for
personal use only and to print copies of
documentation for personal use provided that
the documentation contains Apple’s copyright
notice.
The Apple logo is a trademark of Apple Inc.
Use of the “keyboard” Apple logo
(Option-Shift-K) for commercial purposes
without the prior written consent of Apple may
constitute trademark infringement and unfair
competition in violation of federal and state
laws.
No licenses, express or implied, are granted
with respect to any of the technology described
in this document. Apple retains all intellectual
property rights associated with the technology
described in this document. This document is
intended to assist application developers to
develop applications only for Apple-labeled
computers.
Every effort has been made to ensure that the
information in this document is accurate. Apple
is not responsible for typographical errors.
Apple Inc.
1 Infinite Loop
Cupertino, CA 95014
408-996-1010
Apple, the Apple logo, Bonjour, Carbon, Cocoa,
iPod, iTunes, Mac, Mac OS, Macintosh,
Objective-C, Pages, Quartz, Safari, Sand, and
Xcode are trademarks of Apple Inc., registered
in the United States and other countries.
Finder, iPhone, and Multi-Touch are trademarks
of Apple Inc.
NeXT is a trademark of NeXT Software, Inc.,
registered in the United States and other
countries.
Java and all Java-based trademarks are
trademarks or registered trademarks of Sun
Microsystems, Inc. in the U.S. and other
countries.
OpenGL is a registered trademark of Silicon
Graphics, Inc.
Simultaneously published in the United States
and Canada.
Even though Apple has reviewed this document,
APPLE MAKES NO WARRANTY OR REPRESENTATION,
EITHER EXPRESS OR IMPLIED, WITH RESPECT TO
THIS DOCUMENT, ITS QUALITY, ACCURACY,
MERCHANTABILITY, OR FITNESS FOR A PARTICULAR
PURPOSE. AS A RESULT, THIS DOCUMENT IS
PROVIDED “AS IS,” AND YOU, THE READER, ARE
ASSUMING THE ENTIRE RISK AS TO ITS QUALITY
AND ACCURACY.
IN NO EVENT WILL APPLE BE LIABLE FOR DIRECT,
INDIRECT, SPECIAL, INCIDENTAL, OR
CONSEQUENTIAL DAMAGES RESULTING FROM ANY
DEFECT OR INACCURACY IN THIS DOCUMENT, even
if advised of the possibility of such damages.
THE WARRANTY AND REMEDIES SET FORTH ABOVE
ARE EXCLUSIVE AND IN LIEU OF ALL OTHERS, ORAL
OR WRITTEN, EXPRESS OR IMPLIED. No Apple
dealer, agent, or employee is authorized to make
any modification, extension, or addition to this
warranty.
Some states do not allow the exclusion or limitation
of implied warranties or liability for incidental or
consequential damages, so the above limitation or
exclusion may not apply to you. This warranty gives
you specific legal rights, and you may also have
other rights which vary from state to state.
Contents
Introduction
Introduction 11
Who Should Read This Document? 12
Organization of This Document 12
Providing Feedback 12
See Also 13
Chapter 1
The Core Application 15
Core Application Architecture 15
The Application Life Cycle 15
The Event-Handling Cycle 18
Fundamental Design Patterns 20
The Application Runtime Environment 21
Fast Launch, Short Use 21
The Application Sandbox 21
The Virtual Memory System 22
The Automatic Sleep Timer 22
The Application Bundle 23
The Information Property List 25
Application Icon and Launch Images 27
Nib Files 28
Handling Critical Application Tasks 29
Initialization and Termination 29
Responding to Interruptions 29
Observing Low-Memory Warnings 31
Customizing Your Application’s Behavior 32
Launching in Landscape Mode 32
Communicating with Other Applications 33
Implementing Custom URL Schemes 34
Displaying Application Preferences 37
Internationalizing Your Application 37
Tuning for Performance and Responsiveness 39
Using Memory Efficiently 40
Floating-Point Math Considerations 41
Reducing Power Consumption 42
Tuning Your Code 43
Chapter 2
Window and Views 45
What Are Windows and Views? 45
The Role of UIWindow 45
3
2009-01-06 | © 2009 Apple Inc. All Rights Reserved.
The Role of UIView 46
UIKit View Classes 47
The Role of View Controllers 50
View Architecture and Geometry 50
The View Interaction Model 50
The View Rendering Architecture 52
View Coordinate Systems 55
The Relationship of the Frame, Bounds, and Center 56
Coordinate System Transformations 57
Content Modes and Scaling 58
Autoresizing Behaviors 60
Creating and Managing the View Hierarchy 61
Creating a View Object 63
Adding and Removing Subviews 63
Converting Coordinates in the View Hierarchy 65
Tagging Views 66
Modifying Views at Runtime 66
Animating Views 67
Responding to Layout Changes 69
Redrawing Your View’s Content 69
Hiding Views 70
Creating a Custom View 70
Initializing Your Custom View 70
Drawing Your View’s Content 71
Responding to Events 72
Cleaning Up After Your View 73
Chapter 3
Event Handling 75
Events and Touches 75
Event Delivery 77
Responder Objects and the Responder Chain 77
Regulating Event Delivery 78
Handling Multi-Touch Events 79
The Event-Handling Methods 79
Handling Single and Multiple Tap Gestures 80
Detecting Swipe Gestures 81
Handling a Complex Multi-Touch Sequence 82
Event-Handling Techniques 83
Chapter 4
Graphics and Drawing 85
The UIKit Graphics System 85
The View Drawing Cycle 85
Coordinates and Coordinate Transforms 86
Graphics Contexts 87
4
2009-01-06 | © 2009 Apple Inc. All Rights Reserved.
CONTENTS
Points Versus Pixels 87
Color and Color Spaces 88
Supported Image Formats 88
Drawing Tips 89
Deciding When to Use Custom Drawing Code 89
Improving Drawing Performance 89
Maintaining Image Quality 90
Drawing with Quartz and UIKit 90
Configuring the Graphics Context 91
Creating and Drawing Images 92
Creating and Drawing Paths 94
Creating Patterns, Gradients, and Shadings 94
Drawing with OpenGL ES 94
Setting Up a Rendering Surface 95
Best Practices 96
Implementation Details 98
For More Information 102
Applying Core Animation Effects 102
About Layers 103
About Animations 103
Chapter 5
Text and Web 105
About Text and Web Support 105
Text Views 105
Web View 107
Keyboards and Input Methods 108
Managing the Keyboard 110
Receiving Keyboard Notifications 110
Displaying the Keyboard 112
Dismissing the Keyboard 112
Moving Content That Is Located Under the Keyboard 113
Drawing Text 115
Chapter 6
Files and Networking 117
File and Data Management 117
Commonly Used Directories 117
Backup and Restore 118
Getting Paths to Application Directories 119
Reading and Writing File Data 121
File Access Guidelines 124
Saving State Information 125
Case Sensitivity 125
Networking 125
Tips for Efficient Networking 126
5
2009-01-06 | © 2009 Apple Inc. All Rights Reserved.
CONTENTS
剩余163页未读,继续阅读
资源评论
yanweidie01
- 粉丝: 0
- 资源: 1
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功