cocoa

Accepting drag operations in an NSCollectionView subclass

I've subclassed NSCollectionView and I'm trying to receive dragged files from the Finder. I'm receiving draggingEntered: and returning an appropriate value, but I'm never receiving prepareForDragOperation: (nor any of the methods after that in the process). Is there something obvious I'm missing here? Code: - (void)awakeFromNib { [...

Clean bindings with structs

I have a model class for which it makes quite a lot of sense to have NSSize and NSPoint instance variables. This is lovely. I'm trying to create an editing interface for this object. I'd like to bind to size.width and whatnot. This, of course, doesn't work. What's the cleanest, most Cocoa-y solution to this problem? Of course I could w...

NSURLDownload Delegate from different Class

hi, I have a NSURLDownload object in one class file. What I want to do is a different class that calls it becoming its delegate so that the delegate calls such as - (void)download:(NSURLDownload *)download decideDestinationWithSuggestedFilename:(NSString *)filename gets called. I call the NSURLDownload containing class like this: [[Ac...

Using ASIHTTPRequest to download a file with Cocoa/MacRuby

I'm still trying to get a handle on Cocoa (both in Obj-C and MacRuby), and I'd really appreciate seeing how to download a file with ASIHTTPRequest (or without it) and MacRuby. Ideally, I'd like to be able show the progress inside a progress bar too. Must use a cocoa method for downloading, since open-uri in MacRuby is borken. Thanks fo...

Cocoa: Display HTML from string

How can I display properly formatted text from an NSString, that just happens to be HTML. The html is coming from the stack overflow API. ...

Consecutive 'if' statements

EDITED FOR TYPO - How can I check one thing AND THEN another, if the first is true? For example, say I have a shopping basket object, and I only want to do something if the basket has been created AND it isn't empty. I've tried: if ((basket) && ([basket numberOfItems] >0))... But the second condition is evaluated even if the first...

How to find NSOutlineView row index when using NSTreeController

I'm using an NSTreeController to manage nodes for an NSOutlineView. When the user adds a new item, I create a new object and insert it: EntityViewEntityNode *newNode = [EntityViewEntityNode nodeWithName:@"New entity" entity:newObject]; // Insert at end of group // NSIndexPath *insertAt = [pathOfGroupNode indexPathByAddingIndex:[selecte...

Removing object from NSMutableArray

Just a small query... I stumbled across the following shortcut in setting up a for loop (shortcut compared to the textbook examples I have been using): for (Item *i in items){ ... } As opposed to the longer format: for (NSInteger i = 0; i < [items count]; i++){ ... } //think that's right If I'm using the shorter version, is there ...

Camera video stream inside CAOpenGLLayer

What I'm trying to achieve is to get the uncompressed camera video stream and to convert it into an OpenGL texture, to show it inside an CAOpenGLLayer. Is it the right flow? I thought to use a tecnique similar to the one proposed here to show movie video frames, but the following snippet is not working, at the end the tex coords are all...

Is it possible to make a subclass of NSObject which support subnodes in IB for iPhone project?

I'm making a custom UI element class for iPhone. It'll cool to edit my class on Interface Builder with hierarchy. Some of my class is management class like UINavigationController, but they're not one of them, subclassed from NSObject. Of course, I can place a NSObject instance on IB, but it cannot have a child node. Is there a way to e...

How do I create a preferences window in Objective-C?

I would like to create a preferences window like in the standard Mac OS X apps (Safari etc.). I have found resources like DBPrefsWindowController from back in 2008 that matches the Apple HIG. Just wondering if there is a new way to accomplish this? I can't locate any standard windows in Interface Builder so I assume Apple doesn't pr...

[Cocoa] CoreData bindings for NSPopupButton

I'm looking to use a dropdown menu (possibly an NSPopupButton object) to represent the hierarchical results of two Core Data entities (Genre and Movie) and their relationships. In my current data model, my Genre entity has a one-to-many relationship with my Movie entity. What I'm now looking to do is generate the contents of an NSPopupB...

How to add information to about screen of my cocoa app in Mac Os X

Hi All, I am pretty new in developing cocoa applications. I have developed a small UI application using cocoa. I wanted to add some information on about screen, currently it shows the app name and version which is 1.00. Can any one help me how i can add some information in about screen, is it possible to add information programmatically ...

Interface Builder error: IBXMLDecoder: The value for key is too large to fit into a 32 bit integer

I'm working with Robert Payne's fork of PSMTabBarControl that works with IB 3.2 (thanks BTW Robert!): http://codaset.com/robertjpayne/psmtabbarcontrol/. The demo application works fine on 64-bit systems, but when I try to open the XIB file in Interface Builder on a 32-bit system I get: IBXMLDecoder: The value (4654500848) for key (myTrac...

Core data fetch only returns unique managed objects

I execute a core data fetch which specifies a predicate as follows: NSPredicate *predicate = [NSPredicate predicateWithFormat:@"identifier IN %@", favoritesIDs]; When there are duplicate items in the favoriteIDs array, the fetch request only returns 1 managed object. How can I ensure that more than one instance is fetched? Thank you. ...

How to call method inside class

How do I call setStatus from within awakeFromNib? -(void)awakeFromNib { setStatus; // how? } /* Function for setting window status */ - (void)setStatus { [statusField setStringValue:@"Idle"]; } ...

Comparison between pointer and integer error

I've got the following line of code in one of my Objective-C methods: if (self.rule.sunday == YES) { do some stuff... } The line produces the following compiler warning: Comparison between pointer and integer It's just a warning, so it's not life-threatening, but it's driving me nuts. Clearly there is some basic concept about integ...

Storing data locally and synchronizing it with data base on linux server

Hi all, I have developed a mac application, which is continuously interacting with database on linux server. As data is increasing it has become costlier affair in terms of time to fetch data from server. So I am planning to store required data locally, say on SQLite and find some mechanism through which I can synchronize it with databa...

[sublayer array] insertSublayer:above: atomic if superLayer stays the same?

Setting: * two threads * one moves layers inside sublayer-array with insertSublayer:above: * the other accesses superlayer of the moved layer at the very same time Question: * is superlayer of the moved layer nil in any moment of insertSublayer:above: or below:? ...

setIncludesSubentities: in an NSFetchRequest is broken for entities across multiple persistent stores

Prior art which doesn't quite address this: http://stackoverflow.com/questions/1774359/core-data-migration-error-message-model-does-not-contain-configuration-xyz I have narrowed this down to a specific issue. It takes a minute to set up, though; please bear with me. The gist of the issue is that a persistentStoreCoordinator (apparentl...