Downloadable code examples for my book, "Programming iOS 5".
Switch branches/tags
Nothing to show
Pull request Compare This branch is 1390 commits behind mattneub:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
ch01p011pointers
ch01p017forloop
ch01p022function
ch01p025files
ch01p030static
ch03p046nilTesting
ch03p054rockTheCasbah
ch03p061functionPointer
ch03p064blocks
ch04p070yourFirstClass
ch05p082polymorphism
ch05p084self
ch05p085dogs
ch05p090numberedDog
ch05p092numberedDogWithProperties
ch05p094numberedDogWithInitializer
ch07p139emptyWindowNoMore
ch07p147outlet
ch07p152actionConfiguredInCode
ch07p153actionConfiguredInNib
ch07p155awakeFromNib
ch10p218subclassUIView
ch10p220category
ch10p222privateMethod
ch10p224protocols
ch10p228optionalMethods
ch10p238foundationClasses
ch11p261actions
ch12p279keyPaths
ch12p298namedDog
ch12p299retainCycle
ch12p301assignWeakRef
ch12p302NotificationLeaker
ch12p305timerMemoryManagement
ch12p316namedDogWithProperties
ch12p317redeclaredProperty
ch12p318overrideSynthesizedAccessors
ch13p327kvo
ch13p329kvo2
ch13p330kvoOnMutableArray
ch14p337customWindowInStoryboardApp
ch14p342frame
ch14p343bounds
ch14p348autoresizing
ch14p349transform
ch15p357mars
ch15p361sixBlueCircles
ch15p369filters
ch15p370drawingInUIView
ch15p386contentMode
ch16p392layerHierarchy
ch16p403compass
ch16p407layerDepth
ch16p408transformLayer
ch17p417imageViewAnimation
ch17p420viewAnimationOld
ch17p424transition
ch17p427blockBasedLimitedRepetition
ch17p428cancelInfiniteRepeatingAnimation
ch17p440customAnimatableProperty
ch17p442groupedAnimation
ch17p453actions
ch17p457emitThis
ch18p469touches
ch18p478gestureRecognizers
ch18p481gestureRecognizerDelegate
ch18p483gestureRecognizerDelegate2
ch18p485hitTesting
ch18p486hitTestClipping
ch18p487compassTappable
ch18p488hitTestingDistortedLayer
ch18p489hitTestingDuringAnimation
ch19p508manualViewController
ch19p512nibViewController
ch19p516nibInstantiatedViewController
ch19p518viewControllerViaStoryboard
ch19p522rotationChangesInterface
ch19p525launchIntoRotation
ch19p528presentedViewController
ch19p533tabBarController
ch19p535modalViewForcingRotation
ch19p535modalViewForcingRotationStoryboarded
ch19p549navigationInterface
ch19p553pageController
ch19p556containerController
ch19p556containerController2
ch19p567memoryWarning
ch20p570scrollViewInCode
ch20p577scrollWithTiling
ch20p579zoom
ch20p580zoomCentered
ch20p583zoomWithDetail
ch20p584zoomWithDetail2
ch20p588dragInScrollView
ch20p590dragInScrollView2
ch21p601cellBackgroundLayering
ch21p602defaultCell
ch21p604addCellSubviewsInCode
ch21p606addCellSubviewsInNib
ch21p609addCellSubviewsNibOutlets
ch21p610addCellSubviewsInStoryboard
ch21p627pickACell
ch21p632searchableTable
ch21p640deleteTableRows
ch21p641editInsertAndRearrangeRows
ch21p645dynamicTableContent
ch22p651popovers
ch22p660popoversStoryboard
ch22p662automaticSearchPopover
ch22p667splitViewNoPopover
ch23p673selfSizingLabel
ch23p678textFieldNonScrolling
ch23p680textFieldScrolling
ch23p686selfSizingTextView
ch23p687textViewAndKeyboard
ch23p689styledText1
ch23p694styledText2
ch24p701webView
ch25p708timeConsumingNavigation
ch25p710customProgressView
ch25p711picker
ch25p722datePickerRange
ch25p722slider
ch25p731button
ch25p732knob
ch25p737navbar
ch25p740tabBar
ch25p741tabBarControllerMore
ch26p748dialogsOniPhone
ch26p754actionSheetPopover
ch26p757localNotification
ch27p764systemSound
ch27p767ducking
ch27p776backgroundPlayerAndInterrupter
ch27p778MidiTest
ch28p786moviePlayer
ch28p792playerLayer
ch29p799mediaQuery
ch29p805queuePlayer
ch29p807mediaPicker
ch30p810pickAMovie
ch30p813takeAPic
ch30p814takeAPic2
ch30p816cameraCaptureWithAVFoundation
ch30p818assetsLibrary
ch31p824addressBook
ch32p833calendar
ch33p848map
ch35p869location
ch35p872magneticNorth
ch35p874shake
ch35p877lyingDown
ch35p878smackMe
ch35p881gyro
ch35p883attitudeRotation
ch36p889basicFileOperations
ch36p895fileHandoff
ch36p901peopleGroups
ch36p906XML
ch36p911SQLite
ch36p912imageIO
ch37p920downloader
ch37p923bonjour
ch38p932mandelbrotNoThreading
ch38p933mandelbrotManualThreading
ch38p935mandelbrotOperation
ch38p939mandelbrotOperation2
ch38p940mandelbrotGCD
ch39p947undoableDrag
figures
iOS4bookExamples
README.md

README.md

This is the downloadable code for my book, "Programming iOS 5: Fundamentals of iPhone, iPad, and iPod touch Development," published by O'Reilly in March 2012. It is the second edition of the book whose previous incarnation was "Programming iOS 4". (The example code from the first edition has been moved off into the folder called "iOS4bookExamples".)

The idea is that if you have the paper edition of the book, you shouldn't have to enter code examples by hand to try them out. And if you have an electronic edition of the book, copying and pasting the code and creating the surrounding Xcode project could be tricky.

The downloadable code examples here are all couched as Xcode projects. So all you have to do is open a project in Xcode and read it, build it, run it. I've tried to comment the code in such a way as to show you where to concentrate your attention.

In some projects, multiple examples are combined; usually in this case you are instructed to changed a #define from 1 to 2 and so forth and then run the project again.

Readers are encouraged to use this code as a starting place. Try tweaking things to see what difference it makes.

You may use this code in your own projects. What you may not do is pass off my examples as your own. If you cite code or anything else from the book, give proper credit.

If you find any issues with this code, please let me know or supply a patch.

NOTE ON PAGINATION: The projects are each in folders whose name starts with the chapter and page roughly corresponding to the position of that code in the actual book. I realize that the page numbers used in the folder names are not useful for those with the Kindle or ePUB editions, but they do keep the examples sorted in order, and they correspond to the pagination of the printed and PDF editions. The project names, inside the folders, will probably look like nonsense to you, as those names are inherited from the old pagination (from the first and second printings of the first edition); but that's of no importance, as you can just ignore those names. Perhaps I'll eventually get around to fixing them.

NOTE ON SCREENSHOTS: The full-resolution original screenshots from the book are included here as well.

Matt Neuburg