About Search Archive
Matt Gallagher: Cocoa with Love Matt Gallagher: Cocoa with Love
← Newer 9 10 11 12 13 14 15 16 17 Older →
  • An NSSplitView delegate for priority based resizing

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

    The default resizing mechanism in NSSplitView is proportional resizing — if the NSSplitView changes size, each column resizes by an equal percent. This works badly in the common case where the columns in a split view are used to separate a side panels from a main view area (for example the "source list" in iTunes or the file tree in Xcode). In this post, I'll show you a delegate class that configures a split view for this side panel and main view behavior — resizing the views in a split view based on a priority list.
    Read more...
  • StreamToMe iPhone App Released

    Aug 21, 2009 (an Objective-C era article)

    StreamToMe is an iPhone app I've written that streams video in most common formats from your Mac to the iPhone/iPod Touch — without prior conversion or copying. It supports the TV out cable for the iPhone, turning your iPhone+Mac into a wireless media center. I'm excited that it's finally on the App Store because I've been using it non-stop during development and I'm really happy with it.
    Read more...
  • Adding shadow effects to UITableView using CAGradientLayer

    Aug 21, 2009 (an Objective-C era article)

    Shadows can be a useful effect, drawing attention to the content of your view by separating the view from the background. They also look cool. In this post, I'll show you how to add shadows to a UITableView using three CAGradientLayers — one above the first row, one after the last row and one for under the navigation bar.
    Read more...
  • Animating a window to fullscreen on the Mac

    Aug 14, 2009 (an Objective-C era article)

    Many Mac OS X applications animate their regular application windows to fullscreen but since there's no dedicated method for the task, there's no standard Apple documentation that covers the operation. If you look for examples on the web, you'll find numerous examples that perform this operation using old APIs or methods intended for permanently fullscreen games (the wrong approach for an application window). In this post I'll show you my preferred approach for making an application window fullscreen, with continuous display and smooth animation.
    Read more...
  • Safe, threaded design and inter-thread communication

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

    The Foundation framework provides all the tools you need for inter-thread communication — without needing to handling locks and synchronization yourself. I'll show you Cocoa's tools for inter-thread communication, notifications and easy synchronization — including far simpler code for posting NSNotifications on the main thread than the Cocoa documentation suggests.
    Read more...
  • Control and configuration of applications through Info.plist

    Aug 3, 2009 (an Objective-C era article)

    The Info.plist file is home to the metadata about your application used by the operating system. Most Cocoa programmers know that it stores the bundle identifier, icon name and version number of an application but the Info.plist can also control access to essential iPhone hardware resources and can change the very nature of your Mac OS X applications. In this post, I'll cover basic Info.plist usage and also explain some of the rarer settings.
    Read more...
  • Rules to avoid retain cycles

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

    Normally in Objective-C, if you follow the basic rule of maintaining a positive retain count for everything you need to hold onto and releasing when you're done, memory management will "just work" — until you create a retain cycle and suddenly no objects in the cycle will ever be freed. In this post, I'll explain retain cycles, common cases where they occur and the solutions to these problems.
    Read more...
  • Temporary files and folders in Cocoa

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

    If you need to use temporary files in your application and you search the Cocoa documentation for "temporary file", you're unlikely to find anything that explains how to create one. Since temporary files and folders are subject to a number of security issues and race conditions when done wrong, it is important to know the correct way to create them. I'll show you some code that you can copy and paste into your applications to create temporary files and folders safely.
    Read more...
  • A simple, extensible HTTP server in Cocoa

    Jul 13, 2009 (an Objective-C era article)

    HTTP is one of the simpler protocols to implement for communication between computers. On the iPhone, since there are no APIs for data synchronization or file sharing, embedding an HTTP server is one of the best ways to transfer data from your iPhone application to a computer. In this post I'll show you how to write your own simple but extensible HTTP server. The server classes will also work on Mac OS X (Cocoa un-Touched).
    Read more...
  • HashValue: an object for holding MD5 and SHA hashes

    Jul 6, 2009 (an Objective-C era article)

    Hash values are small, convenient values that you can generate from larger blocks of data for easy indexing, sorting and tracking. The traditional approach for generating MD5 and SHA hashes on Unix platforms to is to use command-line programs like openssl and md5. Apple provide easier approaches in the CommonCrypto library: here's how to use it, along with an NSValue subclass to wrap the result for interoperability with other Cocoa classes.
    Read more...
← Newer 9 10 11 12 13 14 15 16 17 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: