top
about archive search zqueue.com
Matt Gallagher: Cocoa with Love Matt Gallagher: Cocoa with Love
← Newer 9 10 11 12 13 14 15 16 17 Older →
  • 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...
  • Custom views in Interface Builder using IBPlugins

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

    If you have custom views configured in code, it can be time consuming to configure them for each instance and make them look right in context. To make the process smoother, you can create Interface Builder plugins and configure your objects in Interface Builder. While the Xcode documentation explains how to do this, it is long, thorough and confusing. Here is the simplified set of steps that I use to create Interface Builder plugins quickly.
    Read more...
  • Verifying that a string contains an email address using NSPredicate

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

    To celebrate the official release of iPhone OS 3.0 this week, I will show you how to verify that an NSString contains a syntactically valid email address using NSPredicate — a class that joins the iPhone SDK 3.0 as part of the Core Data additions. This code will work on Mac OS X too since, as with the rest of Core Data, NSPredicate has been part of Mac OS X since 10.4 (Tiger).
    Read more...
  • Revisiting an old post: Streaming and playing an MP3 stream

    Jun 17, 2009 (an Objective-C era article)

    Given the attention it received and the number of bugs I know it contained, I wanted to revisit an old post of mine: Streaming and playing an MP3 stream. In this post, I'll talk about the problems the original contained, how I fixed those problems and I'll present the updated result.
    Read more...
← Newer 9 10 11 12 13 14 15 16 17 Older →
  • Subscribe: RSS or JSON
  • Twitter: @cocoawithlove
  • Github: mattgallagher

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