Is subclassing NSNotification the right route if I want to add typed properties?
I am trying to subclass NSNotification. Apple’s docs for NSNotificationstate the following: NSNotification is a class cluster with no instance variables. As such, you must subclass NSNotification and override the primitive methods name, object, and userInfo. You can choose any designated initializer you like, but be sure that your initializer does not call NSNotification’s implementation […]
(Cocoa) What's the equivalent of a UIViewController subclass in a single window cocoa app?
After messing around with iOS apps, I thought I’d give a Cocoa app a whirl assuming things would be very similar. So I have a single window app with a split view and some NSTableViews (think iTunes) and I’m looking for a place to put my code that will fetch data from the web to […]
How do I use a subclass of NSDocumentController in XCode 4?
I am currently in the process of trying to teach myself Cocoa development. Toward this end, I purchased a mostly-excellent book, Cocoa Recipes for Mac OS X: Vermont Recipes, which walks through creating a sample application. It’s pretty good, but it’s written against XCode 3.2 rather than XCode 4. So far, I’ve been able to […]
QuickLook consumer as a delegate from an NSViewController
I am having some problems implementing QuickLook functionality from a table in an NSView. The limited documentation on QuickLook really doesn’t help at all. After reading through the Apple Docs (which are geared heavily towards custom generators and plugins), I ended up looking at the QuickLookDownloader sample code. This code is based upon a document-based […]
NSDocumentController currentDocument returning nil
I’m working on my first Mac document-based application. I have subclassed NSDocument, reimplementing methods such as – (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError; – (BOOL)writeToURL:(NSURL *)absoluteURL ofType:(NSString *)typeName error:(NSError **)outError; – (void)makeWindowControllers; The main window controller is a subclass of NSWindowsController, that contains two NSViewController subclasses. The problem I’m facing is that I need to […]
How to extend NSTextStorage?
According to documentation, I try to subclass NSTextStorage and use it in text view: /* NSTextStorage is a semi-abstract subclass of NSMutableAttributedString. It implements change management (beginEditing/endEditing), verification of attributes, delegate handling, and layout management notification. The one aspect it does not implement is the actual attributed string storage — this is left up to […]
Should I always release self for failed init methods?
Should I always release self when there is a failure inside init, or should I only do so if I have initialized instance variables first? To put it another way, is this pattern valid? Is there a time when I shouldn’t release self inside an init method, or should I assume that if the control […]
Creating an NSMutableArray with a literal via mutableCopy or arrayWithArray:
Possible Duplicate: Is literal creation of an NSMutableDictionary less efficient than the class helper method? According to the WWDC video that introduces ObjectiveC literals, NSMutableArrays can be initialized like so: [NSMutableArray arrayWithArray:@]; but what if we were to do it like this: [@ mutableCopy]; I know that one is initializing the array, and the other […]