Archive for the “Objective-C” category

User defined literals in Objective-C

by john on November 22, 2013

Dustin Bachrach: OCUDL is an experiment to bring user defined literals to Objective-C. A literal is a shorthand expression that creates a value of a certain type. For example, 25ul creates an unsigned long of 25, and @”hello” creates an (…)

Read the rest of this entry »

UIColor macros for Objective-C

by john on October 29, 2013

Below are two macros I paste into most every project. Besides saving a few keystrokes, they work well when using the color picker application. Let’s look at the macros first: #define RGB(r, g, b) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:1] #define (…)

Read the rest of this entry »

Objective-C Object as a C Structure

by john on March 1, 2009

Okay, so figuring out how to unwind an Objective-C object into its base representation goes against all that is object-oriented programming, however, it’s interesting none-the-less. In Objective-C there is a directive, @defs(), that outputs (at compile time) the list of (…)

Read the rest of this entry »

Objective-C: Where is My Object Retained?

by john on August 8, 2008

Apologies for the gap since my last post. It’s been a long week as my wife and I were in a serious car accident a week ago today. I’ll spare the details, however, let it suffice to say that our (…)

Read the rest of this entry »

Objective-C: Alternative Use of Properties?

by john on July 25, 2008

While scanning a few code examples inside the iPhone SDK, I bumped into something interesting. I wrote a short example to mimic what I found…take a look at the following interface declaration: @interface SomeClass : NSObject { NSString *str; NSDate (…)

Read the rest of this entry »

Objective-C: Properties, Setters and Dot Syntax

by john on July 24, 2008

I’ve been ramping up on iPhone development, and with the NDA still in place (as far as I know), I haven’t been able to blog about what I’ve written/learned. And with that, it’s been quiet in here. Too get back (…)

Read the rest of this entry »

Objective-C: Private Methods

by john on July 2, 2008

Note: What follows is another post in an on-going series for developers who are interested in learning to write applications for the iPhone. The entire series can be found here: iPhone Developer . One common complaint for many new to (…)

Read the rest of this entry »

Objective-C: Categories

by john on July 1, 2008

As an alternative to subclassing, Objective-C categories provide a means to add methods to a class. What’s intriguing, is that any methods that you add through a category become part of the class definition, so to speak. In other words, (…)

Read the rest of this entry »

Objective-C: Initializers

by john on June 30, 2008

Note: What follows is another post in an on-going series for developers who are interested in learning to write applications for the iPhone. The entire series can be found here: iPhone Developer . The code for creating new instances of (…)

Read the rest of this entry »

Objective-C: Memory Management

by john on June 26, 2008

Note: What follows is another post in an on-going series for developers who are interested in learning to write applications for the iPhone. More information about writing for the iPhone can be found here: iPhone Developer Tips . First off, (…)

Read the rest of this entry »

Objective-C: Messaging

by john on June 24, 2008

Note: What follows is another post in an on-going series for developers who are interested in learning to write applications for the iPhone. The entire series can be found here: iPhone Developer . This post introduces messaging within Objective-C. Messaging (…)

Read the rest of this entry »

Objective-C: Defining a Class

by john on June 23, 2008

Note: This post is the start of an on-going series for developers who are interested in learning to write applications for the iPhone. The entire series can be found here: iPhone Developer . One of the first topics to cover (…)

Read the rest of this entry »