计算机专业毕业外文文献翻译.docx

上传人:b****6 文档编号:4831471 上传时间:2022-12-10 格式:DOCX 页数:14 大小:31.37KB
下载 相关 举报
计算机专业毕业外文文献翻译.docx_第1页
第1页 / 共14页
计算机专业毕业外文文献翻译.docx_第2页
第2页 / 共14页
计算机专业毕业外文文献翻译.docx_第3页
第3页 / 共14页
计算机专业毕业外文文献翻译.docx_第4页
第4页 / 共14页
计算机专业毕业外文文献翻译.docx_第5页
第5页 / 共14页
点击查看更多>>
下载资源
资源描述

计算机专业毕业外文文献翻译.docx

《计算机专业毕业外文文献翻译.docx》由会员分享,可在线阅读,更多相关《计算机专业毕业外文文献翻译.docx(14页珍藏版)》请在冰豆网上搜索。

计算机专业毕业外文文献翻译.docx

计算机专业毕业外文文献翻译

XX大学

毕业设计(论文)说明书

英文翻译

专业

网络工程

班级

姓名

XX

学号

指导教师

XX

二OXX年六月十六日

外文文献翻译

Originalcontent:

JackNutting,FredrikOlsson,DaveMark,Jeff,LaMarche著.BeginningiOS7DevelopmentExploringtheiOSSDK[M].Apress.2014.03.19.

What’sDifferentAboutCodingforiOS?

IfyouhaveneverprogrammedinCocoaoritspredecessorsNeXTSTEPorOpenStep,youmayfindCocoaTouch—theapplicationframeworkyou’llbeusingtowriteiOSapplications—alittlealien.Ithassomefundamentaldifferencesfromothercommonapplicationframeworks,suchasthoseusedwhenbuilding.NETorJavaapplications.Don’tworrytoomuchifyoufeelalittlelostatfirst.Justkeeppluggingawayattheexercises,anditwillallstarttofallintoplaceafterawhile.

IfyouhavewrittenprogramsusingCocoaorNeXTSTEP,alotintheiOSSDKwillbefamiliartoyou.AgreatmanyclassesareunchangedfromtheversionsthatareusedtodevelopforOSX.

Eventhosethataredifferenttendtofollowthesamebasicprinciplesandsimilardesignpatterns.However,severaldifferencesexistbetweenCocoaandCocoaTouch.

Regardlessofyourbackground,youneedtokeepinmindsomekeydifferencesbetweeniOSdevelopmentanddesktopapplicationdevelopment.Thesedifferencesarediscussedinthefollowingsections.

OnlyOneActiveApplication

OniOS,onlyoneapplicationcanbeactiveanddisplayedonthescreenatanygiventime.SinceiOS4,applicationshavebeenabletoruninthebackgroundaftertheuserpressesthe“home”button,buteventhatislimitedtoanarrowsetofsituations,andyoumustcodeforit,specifically.

Whenyourapplicationisn’tactiveorrunninginthebackground,itdoesn’treceiveanyattentionwhatsoeverfromtheCPU,whichwillwreakhavocwithopennetworkconnectionsandthelike.iOSallowsbackgroundprocessing,butmakingyourappsplaynicelyinthissituationwillrequiresomeeffortonyourpart.

OnlyOneWindow

Desktopandlaptopoperatingsystemsallowmanyrunningprogramstocoexist,eachwiththeabilitytocreateandcontrolmultiplewindows.However,iOSgivesyourapplicationjustone“window”toworkwith.Allofyourapplication’sinteractionwiththeusertakesplaceinsidethisonewindow,anditssizeisfixedatthesizeofthescreen.

LimitedAccess

Programsonacomputerprettymuchhaveaccesstoeverythingtheuserwholaunchedthemdoes.

However,iOSseriouslyrestrictswhatyourapplicationcanaccess.

YoucanreadandwritefilesonlyfromthepartofiOS’sfilesystemthatwascreatedforyourapplication.Thisareaiscalledyourapplication’ssandbox.Yoursandboxiswhereyourapplicationwillstoredocuments,preferences,andeveryotherkindofdataitmayneedtoretain.

Yourapplicationisalsoconstrainedinsomeotherways.YouwillnotbeabletoaccesslownumbernetworkportsoniOS,forexample,ordoanythingelsethatwouldtypicallyrequirerootoradministrativeaccessonadesktopcomputer.

LimitedResponseTime

Becauseofthewayitisused,iOSneedstobesnappy,anditexpectsthesameofyourapplication.

Whenyourprogramislaunched,youneedtogetyourapplicationopen,preferencesanddataloaded,andthemainviewshownonthescreenasfastaspossible—innomorethanafewseconds.

Atanytimewhenyourprogramisrunning,itmayhavetherugpulledoutfromunderit.Iftheuserpressesthehomebutton,iOSgoeshome,andyoumustquicklysaveeverythingandquit.Ifyoutakelongerthanfivesecondstosaveandgiveupcontrol,yourapplicationprocesswillbekilled,regardlessofwhetheryoufinishedsaving.ThereisanAPIthatallowsyourapptoaskforadditionaltimetoworkwhenit’sabouttogodark,butyou’vegottoknowhowtouseit.

LimitedScreenSize

TheiPhone’sscreenisreallynice.Whenintroduced,itwasthehighestresolutionscreenavailableonahandheldconsumerdevice,byfar.

ButtheiPhonedisplayjustisn’tallthatbig,andasaresult,youhavealotlessroomtoworkwiththanonmoderncomputers.Thescreenisjust320×480onthefirstfewiPhonegenerations,anditwaslaterdoubledinbothdirectionsto640×960withtheintroductionoftheiPhone4’sretinadisplay.Thiswasrecentlyincreasedfurtherto640×1136ontheiPhone5.Thatsoundslikeadecentnumberofpixels,butkeepinmindthattheseretinadisplaysarecrammedintoprettysmallformfactors,soyoucan’tcountonfittingmorecontrolsoranythinglikethat.ThishasabigimpactonthekindsofapplicationsandinteractivityyoucanofferonaniPhone.

TheiPadincreasestheavailablespaceabitbyofferinga1024×768display;buteventoday,that’snotsoterriblylarge.Togiveaninterestingcontrast,atthetimeofwritingApple’sleastexpensiveiMacsupports1920×1080pixels,anditsleastexpensivenotebookcomputer,the11-inchMacBookAir,supports1366×768pixels.Ontheotherendofthespectrum,Apple’slargestcurrentmonitor,the27-inchLEDCinemaDisplay,offersawhopping2560×1440pixels.NotethatneweriPadmodels(everyfull-sizeiPadaftertheiPad2,aswellastheiPadMiniRetina)haveretinadisplaysthatdoublethescreenresolutioninbothdirections.ButaswiththeretinaiPhones,that2048×1536screenisinthesamephysicalspaceastheoldscreenwas,soyoucan’treallycountonusingthosepixelsthesamewayyouwouldonatraditionalscreen.

LimitedSystemResources

Anyold-timeprogrammerswhoarereadingthisarelikelylaughingattheideaofamachinewithatleast512MBofRAMand16GBofstoragebeinginanywayresource-constrained,butitistrue.DevelopingforiOSisnot,perhaps,inexactlythesameleagueastryingtowriteacomplexspreadsheetapplicationonamachinewith48KBofmemory.ButgiventhegraphicalnatureofiOSandallitiscapableofdoing,runningoutofmemoryisveryeasy.

TheiOSdevicesavailablerightnowhaveeither512MB(iPhone4S,iPad2,originaliPadmini,latestiPodtouch),or1024MBofphysicalRAM(iPhone5c,iPhone5s,iPadAir,iPadminiRetina),thoughthatwilllikelyincreaseovertime.Someofthatmemoryisusedforthescreenbufferandbyothersystemprocesses.Usually,nomorethanhalfofthatmemoryisleftforyourapplicationtouse,andtheamountcanbeconsiderablyless,especiallynowthatotherappscanberunninginthebackground.

Althoughthatmaysoundlikeitleavesaprettydecentamountofmemoryforsuchasmallcomputer,thereisanotherfactortoconsiderwhenitcomestomemoryoniOS.ModerncomputeroperatingsystemslikeOSXwilltakechunksofmemorythataren’tbeingusedandwritethemouttodiskinsomethingcalledaswapfile.Theswapfileallowsapplicationstokeeprunning,evenwhentheyhaverequestedmorememorythanisactuallyavailableonthecomputer.iOS,however,willnotwritevolatilememory,suchasapplicationdata,outtoaswapfile.Asaresult,theamountofmemoryavailabletoyourapplicationisconstrainedbytheamountofunusedphysicalmemoryintheiOSdevice.

CocoaTouchhasbuilt-inmechanismsforlettingyourapplicationknowthatmemoryisgettinglow.Whenthathappens,yourapplicationmustfreeupunneededmemoryorriskbeingforcedtoquit.NoGarbageCollection,but...

WementionedearlierthatCocoaTouchusesObjective-C,butoneofthekeyObjective-Cfeaturesoftheearly2000sisnotavailablewithiOS:

CocoaTouchdoesnotsupportgarbagecollection.TheneedtodomanualmemorymanagementwhenprogrammingforiOShasbeenabitofastumblingblockformanyprogrammersnewtotheplatform,especiallythosecomingfromlanguagesthatoffergarbagecollection.

WiththeversionofObjective-CsupportedbythelatestversionsofiOS,however,thisparticularstumblingblockisbasicallygone.ThisisthankstoafeaturecalledAutomaticReferenceCounting(ARC),whichgetsridoftheneedtomanuallymanagememoryforObjective-Cobjects.ARCnotonlyservesasaworthyreplacementtogarbagecollection,it’sactuallybetterinmostrespects.

StartinginOSX10.8,ARCbecamethedefaultmemorymanagementtechnologyforMacapps,andgarbagecollectionhasbeendeprecatedthereinfavorofARC.Andofcourse,it’salsothedefaultmemorymanagementmechanisminiOSaswell.We’lltalkaboutARCinChapter3.

SomeNewStuff

Sincewe’vementionedthatCocoaTouchismissingsomefeaturesthatCocoahas,itseemsonlyfairtomentionthattheiOSSDKcontainssomefunctionalitythatisnotcurrentlypresentinCocoaor,atleast,isnotavailableoneveryMac:

TheiOSSDKprovidesawayforyourapplicationtodeterminetheiOSdevice’scurrentgeographiccoordinatesusingCoreLocation.

MostiOSdeviceshavebuilt-incamerasandphotolibraries,andtheSDKprovidesmechanismsthatallowyourapplicationtoaccessboth.

iOSdeviceshavebuilt-inmotionsensorsthatletyoudetecthowyourdeviceisbeingheldandmoved.

ADifferentApproach

TwothingsiOSdevicesdon’thaveareaphysicalkeyboardandamouse,whichmeansyouhaveafundamentallydifferentwayofinteractingwiththeuserthanyoudowhenprogrammingforageneral-purposecomputer.Fortunately,mostofthatinteractionishandledforyou.Forexample,ifyouaddatextfieldtoyourapplication,iOSknowstobringupakeyboardwhentheusertouchesthatfield,withoutyouneedingtowriteanyextracode.

TheXcodeProjectWindow

Afteryoudismissthesavesheet,Xcodewillcreateandthenopenyourproject.Youwillseeanewprojectwindowx(seeFigure2-5).There’salotofinformationcrammedintothiswindow,andit’swhereyouwillbespendingalotofyouriOSdevelopmenttime.

EvenifyouareanoldhandwithearlierversionsofXcode,you’llstillbenefitfromreadingthroughthissectionsinceitcoversalotofthe

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > PPT模板 > 其它模板

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1