关闭

关闭

封号提示

内容

首页 [iPhone和iPad开发书籍大全].Objective.C.Visual.QuickSta…

[iPhone和iPad开发书籍大全].Objective.C.Visual.QuickStart.Guide(Peachpit.Press.2010-02).pdf

[iPhone和iPad开发书籍大全].Objective.C…

上传者: lkgroidwdfwg 2011-03-18 评分 4.5 0 95 13 434 暂无简介 简介 举报

简介:本文档为《[iPhone和iPad开发书籍大全].Objective.C.Visual.QuickStart.Guide(Peachpit.Press.2010-02)pdf》,可适用于IT/计算机领域,主题内容包含ptgFromtheLibraryofWow!eBookptgVISUALQUICKStArtGUIDEobjectivecStevenHolzne符等。

ptgFromtheLibraryofWow!eBookptgVISUALQUICKStArtGUIDEobjectivecStevenHolznerPeachpitPressFromtheLibraryofWow!eBookptgVisualQuickStartGuideObjectiveCStevenHolznerPeachpitPressEighthStreetBerkeley,CA(fax)FindusontheWebatwwwpeachpitcomToreporterrors,pleasesendanotetoerratapeachpitcomPeachpitPressisadivisionofPearsonEducationCopyrightbyStevenHolznerEditor:JudyZiajkaProductionCoordinator:MyrnaVladicCompositor:DebRobertiProofreader:WendySharpIndexer:FireCrystalCommunicationsCoverDesign:PeachpitPressNoticeofrightsAllrightsreservedNopartofthisbookmaybereproducedortransmittedinanyformbyanymeans,electronic,mechanical,photocopying,recording,orotherwise,withoutthepriorwrittenpermissionofthepublisherForinformationongettingpermissionforreprintsandexcerpts,contactpermissionspeachpitcomNoticeofLiabilityTheinformationinthisbookisdistributedonan“AsIs”basis,withoutwarrantyWhileeveryprecautionhasbeentakeninthepreparationofthebook,neithertheauthornorPeachpitPressshallhaveanyliabilitytoanypersonorentitywithrespecttoanylossordamagecausedorallegedtobecauseddirectlyorindirectlybytheinstructionscontainedinthisbookorbythecomputersoftwareandhardwareproductsdescribedinittrademarksVisualQuickStartGuideisaregisteredtrademarkofPeachpitPress,adivisionofPearsonEducationAnyotherproductnamesusedinthisbookmaybetrademarksoftheirownrespectiveownersManyofthedesignationsusedbymanufacturersandsellerstodistinguishtheirproductsareclaimedastrademarksWherethosedesignationsappearinthisbook,andPeachpitwasawareofatrademarkclaim,thedesignationsappearasrequestedbytheownerofthetrademarkAllotherproductnamesandservicesidentifiedthroughoutthisbookareusedineditorialfashiononlyandforthebenefitofsuchcompanieswithnointentionofinfringementofthetrademarkNosuchuse,ortheuseofanytradename,isintendedtoconveyendorsementorotheraffiliationwiththisbookISBN:ISBN:PrintedandboundintheUnitedStatesofAmericaFromtheLibraryofWow!eBookptgDedicationToNancy,ofcourse!AcknowledgmentsThebookyouholdinyourhandsistheproductofmanypeople’sworkIwouldparticularlyliketothankWendySharpandJudyZiajkafortheirtirelesseffortstomakethisbookthebestitcanbeandDannyKalevforhiscarefultechnicalreviewoftheentiremanuscriptFromtheLibraryofWow!eBookptgivTableofContentsIntroductionviiiChapter:GettingStarted:EssentialObjectiveCCreatingYourFirstProgramCompilingandRunningYourFirstProgramUsingVariablesDisplayingValuesinVariablesWorkingwithDataTypesAddingCommentsUsingArithmeticOperatorsUsingAssignmentOperatorsUsingtheIncrementandDecrementOperatorsChangingTypewithCastOperatorsChapter:DirectingProgramFlowUsingtheifStatementUsingtheelseStatementUsingtheswitchStatementUsingComparisonOperatorsUsingLogicalOperatorsUsingtheConditionalOperatorUsingtheforLoopUsingthewhileLoopUsingthedowhileLoopUsingthebreakStatementChapter:HandlingDataAboutCreatingNSClassObjectsCreatingArraysInitializingArraysLoopingoverArraysCreatingTwoDimensionalArraysUsingPointersUsingPointerMathInterchangingPointersandArraysUsingStringsPassingMessagestoStringObjectsUsingEnumerationsTableofContentsFromtheLibraryofWow!eBookptgvTableofContentsTableofContentsChapter:CreatingFunctionsDefiningaFunctionDeclaringFunctionsUsingPrototypesPassingArgumentstoFunctionsReturningValuesfromFunctionsUsingFunctionScopePassingPointerstoFunctionsPassingArraystoFunctionsPassingConstantDatatoFunctionsUsingRecursionUsingPointerstoFunctionsChapter:ClassesandObjectsCreatingObjectiveCClassesandObjectsUsingClassMethodsCreatinganObjectCreatingObjectMethodsStoringDatainObjectsPassingMultipleArgumentstoMethodsStoringtheInterfaceinaHeaderFileAddingtheImplementationtotheHeaderFileLinkingMultipleFilesUsingConstructorsChapter:ObjectOrientedProgrammingAboutAccessSpecifiersUsingPublicAccessUsingPrivateAccessUsingProtectedAccessUsingClassVariablesAccessingtheCurrentObjectCreatingaVariableforMultipleObjectTypesVerifyingThatanObjectBelongstoaClassCheckinganObject'sClasswithisKindOfClassVerifyingThatanObjectSupportsaMethodCheckingWhetherObjectsSupportaMethodChapter:WorkingwithObjectOrientedInheritanceInheritingfromaClassInheritingBaseClassDataMembersInheritingBaseClassMethodsOverridingBaseClassMethodsOverloadingBaseClassMethodsFromtheLibraryofWow!eBookptgviTableofContentsTableofContentsUsingMultilevelInheritanceLimitingAccessRestrictingAccessUsingConstructorswithInheritanceUsingPolymorphismChapter:Categories,Posing,andProtocolsAboutCategoriesCategories:CreatingtheBaseClassCategories:CreatingCategoriesCategories:PuttingItAllTogetherAboutPosingPosing:CreatingtheBaseClassPosing:CreatingtheDerivedClassPosing:PuttingItAllTogetherAboutProtocolsProtocols:DefiningtheProtocolandInterfacesProtocols:CreatingtheClassImplementationsProtocols:PuttingItAllTogetherChapter:UsingArraysandDictionariesCreatinganArrayAccessingArrayElementsUsingEnumerationtoLoopoveranArrayCreatingaMutableArrayAddingElementstoaMutableArraySortinganArrayReleasingArrayMemoryCreatingaDictionaryEnumeratingaDictionaryCreatingaMutableDictionaryAddingObjectstoaMutableDictionaryChapter:ManagingMemoryinObjectiveCCreatingTestObjectsDisplayingtheRetainCountIncrementinganObject’sRetainCountDecrementinganObject’sRetainCountDeallocatingObjectsfromMemoryUsinganAutoreleasePoolUsingSelfManagedMemoryDeallocatingMemoryYourself:CreatingtheClassFromtheLibraryofWow!eBookptgviiTableofContentsTableofContentsviiDeallocatingMemoryYourself:StoringInternalObjectsDeallocatingMemoryYourself:CreatingthemainMethodDeallocatingMemoryYourself:PerformingDeallocationChapter:ExceptionHandlingCatchingExceptionsHandlingExceptionsUsingtheEndHandlerCreatinganExceptionCheckingWhatExceptionOccurredHandlingMultipleExceptionsPassingExceptionsUptheCallStackReturningValuesfromExceptionHandlersReturningvoidfromanExceptionHandlerCatchingUncaughtExceptionsIndexFromtheLibraryofWow!eBookptgviiiIntroductioniWelcometoObjectiveCThisbookisyourguidedtourofthisexcitinglanguage,anditgivesyouwhatyouneedtostartworkingwithObjectiveCatonceUsingObjectiveC,youcanwriteprofessionalprogramsthatmakeuseofmanyobjectorientedfeaturesfromthebasicsuptoadvancedclassinheritanceandexception(runtimeerror)handlingObjectiveCrunsonmanydifferentplatformsForthemostpart,yourcodeshouldworkunchangedonallplatformsthatObjectiveCsupports,butwheredifferencesinsupportexist,thisbookpointsthemouttoyouThisbookstartswiththebasicsandcontinuesonthroughadvancedtopicsYou’llbeginbylookingathowtogetObjectiveCstartedandhowtorunbasicprogramsFromthere,you’llexploredatahandling,againstartingwiththebasicsandmovingonthroughadvancedtopicsAfterlookingathowtowriteyourownfunctions,you’llwrapfunctionsanddatatogetherintoobjectsthecoreofObjectiveCprogrammingAndwhenyoustartworkingwithobjectorientedprogramming,thelidisoffandwe’llpushtheenvelopeasfarasitcangoIntroductionThat’stheplan,then:topresentaguidedtourofObjectiveC,takingyoufromthebeginningtothemostadvancedtopicsLet’sgetstartedwithChapternowFromtheLibraryofWow!eBookptgGettingStarted:EssentialObjectiveCThisbooktakesyouonaguidedtourofObjectiveC,fromthebasicsonupthroughthecoolstuffObjectiveCisacrossplatformlanguage,soyou’llfinditonmanysystems:theMac,ofcourse,butalsoLinux,UNIX,Windows,andmoreanditscoreprogrammingcodestaysthesameacrossallthoseplatformsObjectiveCisactuallyalayerbuiltontopoftheClanguage,andeverythingthatworksinstandard(thatis,ANSI)CworksinObjectiveCObjectiveCalsoaddstonsofobjectorientedfeaturestotheoriginalClanguageThewayitusesobjectsiswhatmakesObjectiveCsopopular,butjustwhatisanobjectObjectorientedprogrammingwasintroducedwhenprogramsbegantogetverylargeandthestructureofthecodebegantogetinthewayObjectorientedprogrammingletsprogrammerswrapwholesectionsoftheircodeintoeasilyhandled,selfcontainedobjectsandsoletthembreakuptheircodecontinuesonnextpageGettingStarted:EssentialObjectiveCFromtheLibraryofWow!eBookptgChapterGettingStarted:EssentialObjectiveCForexample,sayyouhaveabowlofpuddingthatyouwanttokeepcoldYoucouldsetupasystemofcoolantpipes,switches,anddialsthatcoolyourpuddingbutwhichtakeyourconstantattention:youhavetowatchthetemperature,andwhenthepuddinggetstoowarm,youhavetoturnonthecoolantcompressorandpumpandsoonwhenthepuddinggetscoldenough,youhaveswitchthosethingsoffThatwastheoldwayofprogramming,withthegutsofeveryiteminyourprogramlaidbaretothewholerestoftheprogramObjectorientedprogramming,bycontrast,letsyouwrapallthatfunctionalityintoasingleobject:arefrigeratorTherefrigerator’sjobistokeepthingslikepuddingcoldwithoutalotoffussonyourpartItisresponsibleformaintainingitsowninternalstatethatis,remainingcoldinsideIthasthermostatsandrelaysandtheliketoautomaticallyhandlethejobsyoupreviouslydidmanuallySoifyouwantyourpuddingkeptcold,simplyputitintherefrigeratorAllthedetailsarehiddenfromview,andyourkitchenbecomesamucheasierplacetohandleconceptuallySoitiswithobjectorientedprogrammingNowyoucanwrapcodeanddatatogetherintoobjectsthatareselfcontained,andbecauseallthedetailsarehidden,yourinteractionwiththoseobjectsbecomesalotsimplerThat’sthesecretbehindobjectorientedprogramming:divideandconquerInthisbook,you’llseewhatmakestheobjectsinObjectiveCtickThey’redifferentthantheobjectsinotherlanguagestheycommunicatewithmessagesyoudon’tcallthecodeinthemdirectlybutthey’rejustaspowerful,andoftenmoresoWe’llstartinthischapterwiththebasics:handlingbasicdataitems,printingresultsfromObjectiveCprograms,runningyourprograms,andmoreFromtheLibraryofWow!eBookptgGettingStarted:EssentialObjectiveCCreatingYourFirstProgramCreatingYourFirstProgramWe’regoingtojumprightintoObjectiveCbycreatingandrunningaprogram,whichwe’llnamefirstmWe’llstartbycreatingafunctionthatis,abitofcodethatyoucancallbynamenamedmain( ):int main(void){                        }Functionscanbepasseddata,asyou’llseelater,butthisfunctionisn’tpassedanydata,whichiswhyweusethekeywordvoidintheparenthesesFunctionscanalsoreturnvalues,andthemain( )functionreturnsanintegervaluetoObjectiveCindicatingwhethertheprogramsucceededTheintinfrontofmain( )tellsObjectiveCtoexpectanintegerreturnvalueThecodeforthemain( )functiongoesinsidecurlybraces:{and}Next,we’llusethebuiltinObjectiveCfunctionnamedprintf( )todisplaysometextWepassthetextwewantprintf( )todisplayinsideparentheses:int main(void){printf(“WelcometoObjectiveC!”)                        }continuesonnextpagetipTheextensionforObjectiveCcodefilesismFromtheLibraryofWow!eBookptgChapterCreatingYourFirstProgramTousetheprintf( )function,wehavetotellObjectiveCaboutthatfunctionwithafunctiondeclaration,asyou’llseewhenwediscusshowtocreatefunctionsThedeclarationsforthestandardIOfunctionslikeprintf( )arecontainedinanObjectiveCfilenamedstdioh,wherehstandsfor“headerfile”weincludestdiohinourprogramasshownheresoObjectiveCknowsabouttheprintf( )function:#include<stdioh>int main(void){  printf (“Welcome to ObjectiveC!”)                        }Whentheprogramends,ObjectiveCwillexpectsomeindicationofwhetherthefunctionsucceededWe’llreturnavalueoftoObjectiveC,whichmeanstherewerenoerrorsListingshowstheentireprogram,whichyouwillcreatestepbystepinthefollowingtaskstipNotethat#importand#includearethesameforourpurposesYoucanusetheminterchangeablyandinanyorder#include <stdioh>int main(void){  printf (“Welcome to ObjectiveC!”)return}ListingYourfirstObjectiveCprogramFromtheLibraryofWow!eBookptgGettingStarted:EssentialObjectiveCCreatingYourFirstProgramtocreateyourfirstObjectiveCprogramontheMac:Fromhttp:developerapplecomiphone,downloadandinstalltheXcodeIntegratedDevelopmentEnvironmentRunXcodeChooseFile>NewProjectIntheNewProjectwindow,chooseApplicationClicktheCommandLineToolicontoselectitFromtheTypedropdownmenu,chooseFoundationClicktheChoosebuttonEnterFirstasthenameofyourapplicationSelectasavelocatio

类似资料

编辑推荐

局方发挥-朱丹溪.pdf

托卡列夫:世界各民族历史上的宗教.PDF

针灸学.pdf

[白门柳].刘斯奋.文字版.pdf

葬礼之后的葬礼.doc

职业精品

精彩专题

上传我的资料

精选资料

热门资料排行换一换

  • 金融物理学:一个简单的综述.pdf

  • 隋唐五代史纲.pdf

  • 隋唐制度渊源略论稿+唐代政治史.…

  • 学略 刘咸炘着.pdf

  • 《西藏的贵族和政府 1728~1…

  • 隋唐使职制度研究.pdf

  • [唐代玄宗肃宗之际的中枢政局].…

  • 子健六爻体用法密钥.doc

  • 鬼谷子无字天书.pdf

  • 资料评价:

    / 240
    所需积分:1 立即下载

    意见
    反馈

    返回
    顶部