About Search Archive
Matt Gallagher: Cocoa with Love Matt Gallagher: Cocoa with Love
← Newer 13 14 15 16 17 18 19 20 21 Older →
  • A Cocoa application driven by HTTP data

    Sep 20, 2008 (an Objective-C era article)

    Here's a tiny application that queries a webpage via HTTP, parses and searches the response and presents the results in a neatly formatted window. In essence, it's what many Dashboard widgets and iPhone apps do but I'll show you how to do it in a regular Cocoa application.

    Brought to you by FuelView, an iPhone application I wrote for fetching FuelWatch information in Western Australia.

    Read more...
  • Drawing gloss gradients in CoreGraphics

    Sep 13, 2008 (an Objective-C era article)

    This post presents a function &mdash DrawGlossGradient(CGContextRef context, NSColor *color, NSRect inRect) &mdash that will draw a "gloss" gradient in a single statement. All colors in the gradient are calculated from the single color parameter.
    Read more...
  • Parametric acceleration curves in Core Animation

    Sep 9, 2008 (an Objective-C era article)

    CAMediaTimerFunction is used to control basic acceleration along a path in Core Animation but is very limited in what in can do. In this post, I look at the mathematics behind CAMediaTimerFunction and present a sample application that simulates some functions that CAMediaTimerFunction can't achieve by using parametric CAKeyframeAnimation values.
    Read more...
  • Application Design in AppKit

    Aug 31, 2008 (an Objective-C era article)

    This is a discussion of high-level application design in Cocoa that aims to explain the major class roles in an AppKit application and how they are connected. I'll show you much more detail than simply "Model-View-Controller" and I also give a specific example of how all the concepts apply to a real application.
    Read more...
  • Safely fetching an NSManagedObject by URI

    Aug 24, 2008 (an Objective-C era article)

    If you need to store a reference to an NSManagedObject outside of an NSManagedObjectContext, then you'll need to convert NSManagedObjects to URIs and back again. At first glance it looks like a simple method will do all the work for you but in reality you must be careful when getting the object back. I'll show you the way to convert an object to a URI and get it back safely.
    Read more...
  • In defense of Objective-C 2.0 Properties

    Aug 16, 2008 (an Objective-C era article)

    Of all the new features in Objective-C 2.0, none were as controversial as declared properties. Judging from the attacks, much of the controversy stems from a misunderstanding about the role that properties occupy in a class. In this post, I'll explain why properties are useful in Objective-C — and it isn't auto-generated getters and setters or the dot syntax.
    Read more...
  • NSArray or NSSet, NSDictionary or NSMapTable

    Aug 9, 2008 (an Objective-C era article)

    Some types of data can be held in more than one kind of collection. Unordered objects that are already guaranteed unique can be sensibly held in an NSArray or an NSSet. Anything an NSDictionary can hold can be held in an NSMapTable. In this post, I measure the performance of creating and using these different options to help you choose which one is right for you.
    Read more...
  • String philosophies: char arrays, std::string and NSString

    Aug 2, 2008 (an Objective-C era article)

    Each of the major C variants on the Mac implement character strings in their own way. It is fairly easy to learn the syntax differences between them but a simple API Reference doesn't explain the reasons for implementations: the different philosophies behind the implementations. In this post, I'll go past the 'How' of string differences and instead explain the 'Why' of differences between the three string implementations.
    Read more...
  • Key Value Information

    Jul 27, 2008 (an Objective-C era article)

    NSKeyValueCoding is used throughout Cocoa (Bindings, Core Data, Collections and more) but despite being a dynamic way of connecting to an object, it doesn't provide dynamic information about its own operation — which keys an object supports or the custom methods used to get and set values. This post will look at how NSKeyValueCoding works and show you how to get supported keys and their methods for any class or object.
    Read more...
  • Better integration for NSViewController and NSView

    Jul 21, 2008 (an Objective-C era article)

    NSViewController simplifies loading an NSView from a NIB file. But it has some limitations compared to NSWindowController (its window loading/managing equivalent). In this post, I'll explain the limitations and present options for overcoming them.
    Read more...
← Newer 13 14 15 16 17 18 19 20 21 Older →
  • Subscribe: RSS or JSON
  • Mastodon: @cocoawithlove
  • Bluesky: @cocoawithlove
  • Github: mattgallagher

© 2008-2024 Matt Gallagher. All rights reserved.
Code may be used in accordance with license on About page.
If you need to contact me: