手机类毕业设计外文翻译_第1页
手机类毕业设计外文翻译_第2页
手机类毕业设计外文翻译_第3页
手机类毕业设计外文翻译_第4页
手机类毕业设计外文翻译_第5页
已阅读5页,还剩61页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、学号:07416522毕业设计(论文)外文翻译(2011届)外文题目 introduction to the iphone 译文题目 iphone 说 明 书 外文出处 wowbook.com introduction to the iphonewe are about to study the idea of a computational process. computational processes are abstract beings that inhabit computers. as they evolve, processes manipulate other abstrac

2、t things called data. the evolution of a process is directed by a pattern of rules called a program. people create programs to direct processes. in effect, we conjure the spirits of the computer with our spells.the iphone is one of the most distinctive game platforms currently available. the touchsc

3、reen, integration with itunes, programming in objective-c, low development cost,and ease of publishing all make for a very strange but promising new developmentopportunity. as the newest kid on the block, the iphone instantly captured a noticeableportion of the mobile phone market and inspired a wav

4、e of copycat devices by makerssuch as motorola, samsung, and lg.as a programmer, you might not be impressed with sales figures and market shares,but you should be interested in the viability of the iphone as a whole. if no one ownsan iphone, no one will buy the games you make for it. the good news i

5、s that even inthe face of the 2009 economic downturn, iphones continued to sell.to get started with the iphone, youll need to get a free apple developer account. nextyoull download the iphone sdk on your mac, which also contains the xcode ide andinterface builder tool for laying out screens. (apple

6、doesnt provide a toolkit for windowsor any other non-mac platform.) and because the iphone api requires you towrite in objective-c, you will need to read a primer on the language if you do notalready understand it. this chapter takes you step by step through all of these tasks.apple developer accoun

7、t and downloading the sdkthe first step in setting up your iphone development environment is to register an appledeveloper account. signing up for an account is free and gives you access to applesonline documentation, tutorial videos, and the sdk download:1. go to 2. click the register link, and the

8、n click start now. choose the option to create anew apple id, or to log in using an apple id from an itunes or app store account.3. once you have registered, you can log in to the iphone dev center.4. apple may already have emailed you a link to download the free sdk, or you maychoose to download th

9、e sdk using the link from the website. note that you shouldnot download xcode separately because it is included within the sdk downloadpackage (and the version of xcode that comes with the sdk may be newer thanwhat is otherwise available).5. once downloaded, install the sdk, which will make xcode an

10、d interface builderaccessible to you in the /developer/applications folder on your hard drive (you canalso activate spotlight and search for xcode and interface builder to launch eitherapplication quickly).the free developer account will allow you to build applications and run them in asimulator on

11、your mac. however, to load your application onto a phone, you will alsoneed to sign up for the paid developer program. this requires a small annual fee, soeven if you are a private developer, it wont hurt your wallet too much:1. go to 2. you will have two options: standard program and enterprise pro

12、gram. if you arewriting games for the general public, you probably do not want the enterpriseprogram. if you read closely, you will notice the enterprise program is actually forcreating applications that only you and your company will use internally. if youplan to create games that will be sold via

13、the app store, rest assured that thestandard program is the correct choice for you.3. select enroll now and log in if necessary.4. you now have another choice: enroll as an individual or as a company. if youchoose individual, you will not be able to add other programmers or quality assurancemembers

14、to your account, which is necessary to distribute your applicationto others during the development and testing process. however, if you select company,you will be required to provide detailed information about your company.5. continue through the website, selecting the appropriate information, until

15、 youarrive at a screen that says “thank you for submitting your enrollment.”now youmust wait for an email from apple (which may take on the order of a month toarrive).signing up for the paid developer program will also give you access tobeta releases of future versions of the iphone os and sdk, but

16、onlyduring the times at which apple chooses to make them available.it is good to get your paid developer account enrollment going as soon as possible sothat it will be available when you actually need it.application bundleswhen you build an application using xcode, the end result is called an applic

17、ationbundle. in mac os x and the iphone, an application bundle is a special type of directory2 | chapter 1: introduction to the iphonedownload at wowebook.comthat holds an executable file and the resources needed to run it. this includes an iconto represent the application, files with special inform

18、ation about the application, andany images or sounds the application uses.in the finder, an application bundle simply appears as its applicationicon; right-click or ctrl-click on it and select view package contentsfrom the menu to see whats inside.although you cant do this on the iphone, you can fin

19、d iphone applicationsin the iphone simulator. if you have the iphone sdk installed,you can use spotlight to search for the mobilesafari.app file. show thisfile in the finder (dont try to run it on your mac), and view its packagecontents (some of which appears in the following list).a typical iphone

20、application bundle might have the following structure:executable(required.) this is the compiled code executable; it will typically have the samename as your application. in mobilesafari.app, this is the file named mobilesafari.info.plist(required.) this is a collection of properties, in key-value p

21、air form, that specifiesimportant information about your application. notable properties listed here arethe display name of your application, the version number, and a unique id number.these files use a binary format that can be read in a text editor, but you can usethe property list editor located

22、in /developer/applications/utilities to view them.icon.png(required.) this is a 57 *57 pixel icon used to represent your application on theiphone home screen. glossy button effects will be added on top of this imageautomatically, so it should be flat-colored.various resources(optional.) all common r

23、esource files, such as images, sounds, and binary data,used by your application will be placed in the same folder as the executable. theonly subfolders present in an iphone application bundle are for localized resources.localization folders(optional.) if your application supports multiple languages,

24、 you may add subfoldersto the bundle, which contain resources that cater to individual languages.the folder names will have a language name or an iso language abbreviation followedby .lproj; for example, english.lproj, french.lproj, german.lproj, anduk.lproj would each contain resources specific to

25、english, french, german, anduk english languages, respectively.settings.bundle(optional.) you will create this file if you want your application to provide userpreference options in the settings application that comes with the iphone.icon-settings.png(optional.) if you added a settings.bundle file,

26、this image is used to represent theapplication in the settings application. the image should be 29 *29 pixels. however,if you do not add this image, the icon.png image will be scaled and usedautomatically.mainwindow.nib(optional.) created by the interface builder application, mainwindow.nib contains

27、code and resources necessary to draw your application as it starts up.more .nib files can be loaded after this one, but it will always be the first in memory.default.png(optional.) this image is displayed as the application is loading the main-window.nib file. it should be full screen, which is 480

28、*20 pixels on the iphone.if this image is close to what the user will see when the application is finishedloading, the load process will appear to take less time.itunesartwork(optional.) if you are distributing the application outside the app store, this artworkis used to display your application wh

29、en loading onto a handset using itunes.more on this later.as you will see in the next section, when youre creating your application, xcode andinterface builder will create most of these files for you.xcode and interface builderif you are unfamiliar with xcode, you may be reluctant to learn a new ide

30、 at first.however, the way iphone development works, you pretty much have to. fortunately,once you get used to it, youll see that xcode is pretty good at what it does. it has allthe features you would expect from an industry-standard ide: it jumps to the line ofcompile errors, auto-completes complic

31、ated api methods, and has integrated sdkreferences.and it gets better: xcode supports on-device debugging, a full-featured iphone simulator,useful project wizards, refactoring tools, and even direct integration with subversionrevision control repositories.an xcode project contains all the code, reso

32、urces, certificates, and configurations youneed to create an iphone application. to get acquainted with the environment, openyour xcode ide and follow these steps to create a typical “hello world” application:1. open xcode.2. select file new project.3. in the dialog that opens, select iphone os, the

33、n view-based application (see figure1-1), and click choose.4. name the project “helloworld” and click save.5. at this point, you can build and run (click the build and go icon in the toolbar).the helloworld application shows only a blank gray screen when run in the simulator,as shown in figure 1-2.f

34、igure 1-1. selecting view-based applicationnot very interesting yet, is it? before we go on to make this a proper “hello world”application, here is a quick rundown of the files that were generated when you createdthe project:helloworldappdelegate.m, helloworldappdelegate.hthe class held in these fil

35、es can be considered the main code entry point of theapplication. the app delegate controls the main window and main view controller,and is responsible for setting them up for display.helloworldviewcontroller.m, helloworldviewcontroller.hthis class in these files holds the main view, and is responsi

36、ble for showing thehorribly uninteresting gray screen. we will be editing it to say “hello world” soon.figure 1-2. empty application in the simulatormainwindow.xibthis interface builder file results in a .nib file that is placed in your applicationbundle when the project is compiled. when loaded, it

37、 creates the app delegate,and loads the main window and view controller.helloworldviewcontroller.xibthis file lays out the design for the helloworldviewcontrollers view.nib stands for nextstep interface builder, and xib stands for xcodeinterface builder. nib files are dense compiled binary files; xi

38、b files arehuman-readable xml files. as we mentioned earlier, xcode compilesxib files into nib files. the xib format was created specifically to solveissues with merging nib files in projects under source control, since youcan diff xml files more easily than binary files.now we need to draw the “hel

39、lo world” text. we can go about this in several ways:. add a cocoa uilabel by writing code directly in helloworldviewcontroller.m. add a cocoa uilabel in interface builder to helloworldviewcontroller.xib. define a subclass of uiview, and use a quartz font rendering in drawrect. create a texture-mapp

40、ed font in opengl es to render with.lets start with the first method: adding a uilabel by writing code in helloworldview-controller.m. a stub method named viewdidload is already inside helloworldview-controller.m, which is a good place to add our code. this method will be calledafter .nib file loadi

41、ng is done, but before rendering begins:1. replace the viewdidload function in helloworldviewcontroller.m with the following(this function is commented out by default, so be sure to remove the /* thatprecedes it and the */ that follows it):- (void) viewdidload super viewdidload;/draw hello world usi

42、ng cocoa uikit./grab the screen dimensionsint w = self.view.frame.size.width;int h = self.view.frame.size.height;/create a text label: the size 100,50 here is arbitrary/ but it must be large enough to fit the hello world text.uilabel* label = uilabel alloc initwithframe:cgrectmake(0, 0, 100, 50);/pu

43、t the label at the center of the screenlabel.center = cgpointmake(w/2, h/2);/align the text to the center of the label (default is left)label.textalignment = uitextalignmentcenter;/dont draw the labels background (default is white)label.backgroundcolor = uicolor clearcolor;label.text = hello world!;

44、/add label to our view, so that it can be renderedself.view addsubview:label;/since we allocd label in this method we need to release label herelabel release;2. build and run the project (if you havent quit the simulator from its previous run,youll be prompted to stop it). the app should now display

45、 your text (see figure1-3).figure 1-3. “hello world!” text shownnow lets go over the second method, adding a uilabel to helloworldviewcontroller.xib using interface builder. you must undo your changes if you followed the precedingexample:1. open the helloworldviewcontroller.xib file in interface bui

46、lder by double-clickingit from the list of project files in xcode.2. double-click the view object to begin editing it (figure 1-4).figure 1-4. double-clicking the view object to edit the file3. find the label object in the library panel (open the panel by selectingtools仺library panel, if it is not a

47、lready open). see figure 1-5.4. drag the label into the view editing window, as shown in figure 1-6.5. double-click the new label and edit the text to say “hello world”. you can alsoedit it from the attributes inspector (tools仺attributes inspector).6. in the label size inspector (tools size inspecto

48、r), click both of the placementbuttons to center the label horizontally and vertically, as shown in figure 1-7.7. save the .xib file and return to xcode. building the application will updatethe .nib file, which will cause the changes to appear when the application is run,as shown in figure 1-8.8. wh

49、en the .nib file is loaded, it creates and displays the uilabel. if our code needsaccess to read or modify the created label, we can link it to an iboutlet in our code.in helloworldviewcontroller.h, replace the stub definition of helloworldviewcontroller with the following:interface helloworldviewco

50、ntroller : uiviewcontroller iboutlet uilabel* mylabel;an iboutlet is a code tag that enables interface builder to recognize possible handlesin code that can be linked to.figure 1-5. selecting label from the objects library9. to link the .nibs label to the outlet, open helloworldviewcontroller.xib in

51、 interfacebuilder and open the connections inspector (tools connections inspector).then, click to select the label, drag the labels new referencing outlet to the filesowner object, release, and click on the “mylabel” text that shows up in theapple developer account and downloading the sdk | 9downloa

52、d at wowebook.compop-up menu (see figures 1-9 through 1-11). because we set the referencing outlet,the two objects will be linked together when the .nib is loaded. specifically,when helloworldviewcontroller.nib is loaded in the application, it will know toset the variable mylabel to point at the uil

53、abel we just linked to.10. save helloworldviewcontroller.xib and quit interface builder.now our code has access to the label through mylabel. this linking process is usedfrequently in interface builder to specify outlets, actions, delegates, and data sources.any interaction between visible elements

54、of the interface and your code is made viainterface builder links.figure 1-6. adding a new label to the viewfigure 1-7. modifying the label object propertiesfigure 1-8. “hello world!” text with label objectfigure 1-9. the label connections windowfigure 1-10. clicking and dragging from new referencin

55、g outlet to files ownerviews and controllersthe uiview class represents a view object in the iphone sdk. views are visible rectangularportions of the screen that handle drawing and animation, event handling, andsubview management. if you look at the ipod application that comes with your iphone,youll

56、 see that the navigation bar at the top, the tab bar at the bottom, and the contentarea in the middle are three separate views.when creating a view-based application in the new project wizard, start with a singleview controller and a single view. you may want more views as your applicationbecomes mo

57、re complex. for example, you may have one view for your game, anotherfor a main menu, one for a settings screen, and another for an online high score screen.if your views share a lot of the same code, it makes sense to add those views to thesame view controller, along with the shared code. in the preceding example, we

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论