About Search Archive
Matt Gallagher: Cocoa with Love Matt Gallagher: Cocoa with Love
← Newer 12 13 14 15 16 17 18 19 20 Older →
  • Breadth-first traversal of a graph of Objective-C objects

    Feb 7, 2009 (an Objective-C era article)

    If you have a collection of interconnected objects in Objective-C, what is the best way to traverse them all in order from nearest to furthest? Are the NSMutableSet methods good for tracking already-visited nodes? How much overhead does an NSMutableArray FIFO queue impose relative to a depth-first search (which doesn't require a FIFO queue)? Does NSMutableArray perform better if objects are pushed onto the front, or the back? In this post, I present answers to these questions and more.
    Read more...
  • Interprocess communication: snooping, intercepting and subverting

    Feb 1, 2009 (an Objective-C era article)

    When Xcode is running, Interface Builder seems to magically know which classes, methods and variables are available. Where does Interface Builder get this information? How can you recreate this effect when editing source files in an external editor without Xcode running? This is the story of how I investigated the communication between Xcode and Interface Builder, so that I could recreate it for myself.
    Read more...
  • Multiple virtual pages in a UIScrollView with just 2 child views

    Jan 23, 2009 (an Objective-C era article)

    The UIScrollView and UIPageControl in Cocoa Touch allow for user interfaces with multiple panning pages. The sample project that Apple provides (PageControl) keeps all child views for every page in a lazily loaded array. I'll show you how you can implement this using just two child views, no matter how many virtual pages you wish to represent.
    Read more...
  • Demystifying NSApplication by recreating it

    Jan 18, 2009 (an Objective-C era article)

    In this post I will recreate code that is normally concealed between the NSApplicationMain call (invoked in a Cocoa application's main function) and the sendEvent: method (which distributes the events to windows and views from the main run loop). By recreating this code for you, I hope to explain the steps that occur between program startup and the dispatch of events to your code — so you can gain greater understanding of what NSApplication does on your behalf.
    Read more...
  • Multiple row selection and editing in a UITableView

    Jan 10, 2009 (an Objective-C era article)

    By default, UITableView only supports single-row selection. In this post, I'll show you how to implement multi-row selection, similar to the message edit interface in Mail.
    Read more...
  • Serving an NSManagedObjectContext over an NSConnection

    Jan 5, 2009 (an Objective-C era article)

    In this post, I'll show you how you can serve a Core Data document over a network using NSConnection. This arrangement will never be as efficient or safe as writing your own code to communicate the data over the network but the promise of transparent and automatic networking seemed too tempting to pass up.
    Read more...
  • Heterogeneous cells in a UITableViewController

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

    This post looks at writing a UITableViewController for a table view that contains behaviorally unrelated rows — a common occurrence on the iPhone for tables containing multiple groups. I will present a simple alternative to Apple's UITableViewController template code that will reduce complexity and code as well as refocus areas-of-concern for this heterogeneous arrangement.
    Read more...
  • OrderedDictionary: Subclassing a Cocoa class cluster

    Dec 18, 2008 (an Objective-C era article)

    The default Cocoa collection classes are highly capable but there are situations where you may need to override them to alter their functionality. I'll explain when and how you should do this with an example class: OrderedDictionary (an NSMutableDictionary subclass that maintains ordering of its keys).
    Read more...
  • Drawing a custom window on Mac OS X

    Dec 12, 2008 (an Objective-C era article)

    Occasionally, you may want a window to look completely different to the standard window styles provided by Apple. This post will show you how to draw a custom window and implement close, resize and drag functionality.
    Read more...
  • Instance variable to synthesized property (an Xcode user script)

    Dec 6, 2008 (an Objective-C era article)

    Xcode user scripts take the repetition out of many aspects of programming. To show you how this can work, here's a script I wrote to turn an instance variable into a property (complete with declaration and synthesis) just by selecting the variable and invoking the script.
    Read more...
← Newer 12 13 14 15 16 17 18 19 20 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: