注册 登录
主题 : iphone开发中英互译学习(帮助你快速看懂ios英文文档)
级别: 新手上路
UID: 87302
精华: 0
发帖: 17
可可豆: 152 CB
威望: 152 点
在线时间: 41(时)
注册时间: 2011-08-15
最后登录: 2013-07-24
0 楼:  发表于: 2011-10-28 11:30    发自: Web Page
来源于 语法问题 分类

iphone开发中英互译学习(帮助你快速看懂ios英文文档)   

#import <UIKit/UIKit.h>

int main(int argc, char *argv[]) {
    
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    int retVal = UIApplicationMain(argc, argv, nil, nil);
    [pool release];
    return retVal;
}

The creation of this main routine is automatic
此主程序的创建是自动的

You start off with an #import directive , which you’ll recall is Objective-C’s substitute for #include.
这个程序由#import指令开始,它是Objective-C对#include的替代品。

You next create an NSAutoreleasePool . You’ll recall that we mentioned this in our discussion of memory management in the previous chapter.
然后创建了NSAutoreleasePool. (我们应该可以回忆起、应该还记得)在上一章的内存管理中我们曾经讨论过。

As with the rest of the main.m file, you should never have to change this, but we’re nevertheless going to briefly touch on what the latter two arguments mean—though they’ll usually be set to their defaults, thanks to the nil arguments.
对于main.m文件的其他部分,是没有必要更改的,但我们还是要简单介绍后两个参数的含义,它们通常通过nil参数被设置为默认值。

The principalClassName defines the application’s main class, UIApplication, by default.
默认情况下,principalClassName定义了应用程序的主类UIApplication

The UIApplication object is created as part of this startup routine, but you’ll note that no link to the object is provided.
UIApplication对象作为启动程序的一部分而创建的,但我们会注意到,没有提供任何到此对象的链接。

The delegateClassName defines the application object’s delegate, an idea we introduced in chapter 10.
delegateClassName定义了应用程序对象的委托,我们曾在第10章介绍过这个概念。

There are three main ways that events can appear on the iPhone: through bare events (or actions), through delegated events, or through notification.
事件出现在iPhone上有三种主要方式:通过空事件(或动作)、通过委托事件、或者通过通知。

Most user input on the iPhone results in an event being placed into a responder chain.
多数用户在iPhone上的输入会产生置于(位于)响应者链中的一个事件。

This is a linked set of objects that, for the most part, goes backward up through the view hierarchy.
响应者链是一组对象链接集,多数部分是通过视图层次结构向上延伸的。

Any input is captured by the first responder, which tends to be the object that the user is directly interacting with.
任何输入都是由第一响应者先捕捉到的,它一般是与用户直接交互的对象。

If that object can’t resolve the input, it sends it up to its superview (e.g., a label might send it up to its full-screen view), then to its superview, all the way up the chain (e.g., up through the views, then up through the view controllers).
如果这个对象不能解析用户的输入,那么,它将把输入发送到它的父视图(例如,一个标签可能发送到其全屏幕视图),然后到其父视图,不断连锁向上(例如,向上至视图,然后向上至视图控制器)。

If input gets all the way up the view hierarchy to the window object, it’s next sent on to the application itself, which tends to pass it off to an application delegate as a last resort.
如果输入沿着视图层次结构一直向上至窗口对象,那么之后,它将被发送到应用程序本身,并最终传递到应用程序委托。

Any of these objects could choose to handle an event, which stops its movement up the responder chain.
这些对象中的任何一个都可以选择处理一个事件(用户输入),这将会停止响应者链的传递。

Following the standard MVC model, you’ll often be building event response into UIViewControllers objects, which are pretty far up the responder chain.
按照标准的MVC模式,你通常要将事件响应构建到UIViewControllers对象中,此对象在响应者链中相当远。

Standard event response and delegation represent two ways that objects can be alerted to standard events, such as fingers touching the screen.
标准事件响应和委托代表了就标准事件(如手指触摸屏幕)向对象发出警告的两种方式。

There’s also a third method that can be used to program many different sorts of activities, such as an iPhone’s orientation changing or a network connection closing: the notification.
还可以使用第三种方式,可用于方案,如iPhone的方向改变或网络连接结算活动,许多不同的种类:通知。

Objects register to receive a certain type of notification with the NSNotificationCenter, and afterward may process those notifications accordingly.
对象注册使用NSNotificationCenter接收一定类型的通知,然后相应的处理这些通知。

Again, we’ll discuss this topic in chapter 14.
同样,我们将在第14章讨论这个话题。

For any UIControl objects, such as buttons, sliders, and toggles, events are often turned into actions.
对于任一UIControl对象,如按钮,滑动条,以及切换开关,事件往往变成动作。

Whereas events report touches to the screen, actions instead report manipulations of the controls and are thus easier to read.
事件将触摸报告到屏幕,而动作则报告控制的操作,因而更易于阅读。

Actions follow a slightly different hierarchy of response.
动作所遵循的响应层次结构略有不同。

Touch events can only be captured by UIView objects.
触摸事件只可由UIView对象捕获。

关键词: iphone开发

CocoaChina社区转载内容已尽可能注明出处,如未能核实来源或转发内容图片有权利瑕疵的,请及时联系社区进行修改或删除【联系方式QQ : 3442093904 邮箱:support@cocoachina.com】文章内容为作者独立观点,不代表CocoaChina社区立场。版权归原作者所有,如申请授权请联系作者,因文章侵权CocoaChina社区不承担任何法律及连带责任。

描述
快速回复

关注本帖(如果有新回复会站内信通知您)

发帖、回帖都会得到可观的积分奖励。查看论坛积分规则

按"Ctrl+Enter"直接提交
    顶部