Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
I. Getting Started
1. You and This Book
C and Objective-C
How this book works
How the life of a programmer works
2. Your First Program
Installing Apple’s developer tools
Getting started with Xcode
Where do I start writing code?
How do I run my program?
So, what is a program?
Don’t stop
II. How Programming Works
3. Variables and Types
Types
A program with variables
Challenge
4. if/else
Boolean variables
When curly braces are optional
else if
For the more curious: conditional operators
Challenge
5. Functions
When should I use a function?
How do I write and use a function?
How functions work together
How functions work together
Standard libraries
Local variables, frames, and the stack
Scope
Recursion
Looking at frames in the debugger
return
Global and static variables
Challenge
6. Format Strings
Using tokens
Escape sequences
Challenge
7. Numbers
Integers
Integers
Tokens for displaying integers
Integer operations
Floating-point numbers
Floating-point numbers
Tokens for displaying floating-point numbers
The math library
Challenge
A note about comments
8. Loops
The while loop
The for loop
break
continue
The do-while loop
Challenge: counting down
Challenge: user input
9. Addresses and Pointers
Getting addresses
Storing addresses in pointers
Getting the data at an address
How many bytes?
NULL
Stylish pointer declarations
Challenge: how much memory?
Challenge: how much range?
10. Pass-By-Reference
Writing pass-by-reference functions
Avoid dereferencing NULL
Challenge
11. Structs
Challenge
12. The Heap
III. Objective-C and Foundation
13. Objects
Objects
Objects
Classes
Creating your first object
Methods and messages
Methods and messages
Message sends
Another message
Class methods vs. instance methods
Sending bad messages
A note on terminology
Challenge
14. More Messages
A message with an argument
Multiple arguments
Nesting message sends
alloc and init
Sending messages to nil
id
Challenge
15. Objects and Memory
On pointers and their values
Memory management
Memory management
ARC
16. NSString
Creating instances of NSString
NSString methods
Class references
Other parts of the documentation
Challenge: finding more NSString methods
Challenge: using readline()
17. NSArray
Creating arrays
Accessing arrays
Iterating over arrays
NSMutableArray
Old-style array methods
Challenge: a grocery list
Challenge: interesting names
18. Your First Class
Accessor methods
Accessor methods
Accessor naming conventions
self
Multiple files
Class prefixes
Challenge
19. Properties
Declaring properties
Property attributes
Dot notation
20. Inheritance
Overriding methods
super
Inheritance hierarchy
description and %@
Challenge
21. Object Instance Variables and Properties
Object ownership and ARC
Object ownership and ARC
Creating the BNRAsset class
Adding a to-many relationship to BNREmployee
Challenge: holding portfolio
Challenge: removing assets
22. Class Extensions
Hiding mutability
Headers and inheritance
Headers and generated instance variables
Challenge
23. Preventing Memory Leaks
Strong reference cycles
Weak references
Zeroing of weak references
For the More Curious: manual reference counting and ARC history
For the More Curious: manual reference counting and ARC history
Retain count rules
24. Collection Classes
NSSet/NSMutableSet
NSDictionary/NSMutableDictionary
Immutable objects
Sorting arrays
Filtering
Collections and ownership
C primitive types
Collections and nil
Challenge: reading up
Challenge: top holdings
Challenge: sorted holdings
25. Constants
Preprocessor directives
Preprocessor directives
#include and #import
#define
Global variables
enum
#define vs. global variables
26. Writing Files with NSString and NSData
Writing an NSString to a file
NSError
Reading files with NSString
Writing an NSData object to a file
Reading an NSData from a file
Finding special directories
27. Callbacks
The run loop
Target-action
Helper objects
Notifications
Which to use?
Callbacks and object ownership
For the more curious: how selectors work
28. Blocks
Using blocks
Using blocks
Declaring a block variable
Composing a block
Passing in a block
typedef
Blocks vs. other callbacks
More on blocks
More on blocks
Return values
Anonymous blocks
External variables
Challenge: an anonymous block
Challenge: using a block with NSNotificationCenter
29. Protocols
Calling optional methods
30. Property Lists
Challenge
IV. Event-Driven Applications
31. Your First iOS Application
GUI-based applications
Getting started with iTahDoodle
BNRAppDelegate
Model-View-Controller
The application delegate
Setting up views
Running on the iOS simulator
Wiring up the button
Wiring up the table view
Saving and loading data
Saving and loading data
Adding a C helper function
Saving task data
Loading task data
For the more curious: what about main()?
For the more curious: running iTahDoodle on a device
32. Your First Cocoa Application
Getting started with TahDoodle
Setting up views in Interface Builder
Setting up views in Interface Builder
Setting up the button
Setting up the table view
Adding autolayout constraints
Making connections
Making connections
File’s Owner
Setting the button’s target-action pair
Connecting the table view
Implementing NSTableViewDataSource
Saving and loading data
Challenge
V. Advanced Objective-C
33. init
Writing init methods
A basic init method
A basic init method
instancetype
Using and checking the superclass initializer
init methods that take arguments
Using accessors
Multiple initializers
Deadly init methods
34. More about Properties
More on property attributes
More on property attributes
Mutability
Lifetime specifiers
Advice on atomic vs. nonatomic
Implementing accessor methods
35. Key-Value coding
Non-object types
Key paths
36. Key-Value Observing
Using the context in KVO
Triggering the notification explicitly
Dependent properties
37. Categories
Challenge
VI. Advanced C
38. Bitwise Operations
Bitwise-OR
Bitwise-AND
Other bitwise operators
Other bitwise operators
Exclusive-OR
Complement
Left-shift
Right-shift
Using enum to define bit masks
More bytes
Challenge
39. C Strings
char
char *
String literals
Converting to and from NSString
Challenge
40. C Arrays
Challenge
41. Running from the Command Line
Command-line arguments
More convenient running from the command-line
42. Switch Statements
Introspection
Dynamic method lookup and execution
Management of classes and inheritance hierarchies
How KVO works
Final notes
Challenge: instance variables
Appendix: The Objective-C Runtime
Next Steps
Index
More From Big Nerd Ranch...
← Prev
Back
Next →
← Prev
Back
Next →