计算机专业毕业外文文献翻译Word下载.docx
- 文档编号:17780886
- 上传时间:2022-12-10
- 格式:DOCX
- 页数:14
- 大小:31.37KB
计算机专业毕业外文文献翻译Word下载.docx
《计算机专业毕业外文文献翻译Word下载.docx》由会员分享,可在线阅读,更多相关《计算机专业毕业外文文献翻译Word下载.docx(14页珍藏版)》请在冰豆网上搜索。
班级
姓名
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文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 计算机专业 毕业 外文 文献 翻译