cocoa - Merge cells of NSTableView

Is there any way to merge cell's in a NSTableView? I know there are two modes for displaying data in a NSTableView: cell-based and view-based. If the data are presented by cells, the functiontableView(_ tableView: NSTableView, viewFor tableColumn: NSTableColumn?, row: Int) is responsable, otherwise tableView(_ tableView: NSTableView, rowViewForRow row: Int)Currently I'm using the first one. In iOS, you can use the cell prototype in interface builder to link the views with a custom UITableViewCell, but how can I achieve this for a complete row ...Read more

How to get pixel data from a UIImage (Cocoa Touch) or CGImage (Core Graphics)?

I have a UIImage (Cocoa Touch). From that, I'm happy to get a CGImage or anything else you'd like that's available. I'd like to write this function:- (int)getRGBAFromImage:(UIImage *)image atX:(int)xx andY:(int)yy { // [...] // What do I want to read about to help // me fill in this bit, here? // [...] int result = (red << 24) | (green << 16) | (blue << 8) | alpha; return result;}Thanks!...Read more

cocoa - Exception thrown in NSOrderedSet generated accessors

On my Lion app, I have this data model:The relationship subitems inside Item is ordered.Xcode 4.1 (build 4B110) has created for me the file Item.h, Item.m, SubItem.h and SubItem.h.Here is the content (autogenerated) of Item.h:#import <Foundation/Foundation.h>#import <CoreData/CoreData.h>@class SubItem;@interface Item : NSManagedObject {@private}@property (nonatomic, retain) NSString * name;@property (nonatomic, retain) NSOrderedSet *subitems;@end@interface Item (CoreDataGeneratedAccessors)- (void)insertObject:(SubItem *)value inSubi...Read more

cocoa - Core Data vs SQLite 3

I am already quite familiar with relational databases and have used SQLite (and other databases) in the past. However, Core Data has a certain allure, so I am considering spending some time to learn it for use in my next application.Is there much benefit to using Core Data over SQLite, or vice versa? What are the pros/cons of each?I find it hard to justify the cost of learning Core Data when Apple doesn't use it for many of its flagship applications like or - instead opting for SQLite databases. SQLite is also used extensive...Read more

cocoa - NSData and embedded pointers clarification

The Apple documentation regarding NSData says NSData and its mutable subclass NSMutableData provide data objects, object-oriented wrappers for byte buffers. Data objects let simple allocated buffers (that is, data with no embedded pointers) take on the behavior of Foundation objects.What do they mean by "embedded pointers"? My understanding is that once you put bytes into it, it has no idea what it is unless you decode it at the application level. Anyone know what they are talking about?...Read more

cocoa - NSWindow title bar background and text color

I'm trying to set a background color of NSWindow's title bar (and than change the title bar text color) and I'm stuck. The problem was solved on SO before using Obj-C and with usage of external plugins but there must be a simple way to do it.Did anyone encounter such issue before and would share a code (written in Swift)?...Read more

cocoa - How to deterministically release Core Foundation object in Garbage Collected environment?

I use Core Foundation methods in garbage-collected environment. According to documentation call to CFRelease simply decrements reference count but does not release the object: The difference between the garbage-collected environment and reference-counted environment is in the timing of the object’s deallocation. In a reference counted environment, when the object’s retain count drops to 0 it is deallocated immediately; in a garbage-collected environment, what happens when a Core Foundation object's retain count transitions from 1 to 0 depends ...Read more

cocoa - Does Foundation use Core Foundation?

To me it doesn't seem like it. Of course I don't have sources of Foundation, but in case of GNUStep, take this example.They have a NSArray code like this in the source do they refer to CFArray. goes for all CF counterparts.Why?...Read more

cocoa - How to show a title of document window without icon?

Now I drag a file to the app icon in the dock, this app is based on document . I found that no little image on the left of window title after the app is run and the mainwindow is open . but when I drag a file to the dock icon before the app run and use this method to run the app , a little image on the left of window title to show the file ,just like the xcode etc.Now I want to show the little image both way or not to show the little image both way , How to do ? I think that it maybe the window property based on document , but I don't know how ...Read more

cocoa - NSDocument Subclass not closed by NSWindowController?

Okay, I'm fairly new to Cocoa and Objective-C, and to OOP in general.As background, I'm working on an extensible editor that stores the user's documents in a package. This of course required some "fun" to get around some issues with NSFileWrapper (i.e. a somewhat sneaky writing and loading process to avoid making NSFileWrappers for every single document within the bundle). The solution I arrived at was to essentially treat my NSDocument subclass as just a shell -- use it to make the folder for the bundle, and then pass off writing the actual ...Read more

cocoa - How do I dismiss an NSPanel when creating or opening a new document?

I am working on a document-based Cocoa application. At startup, the user is presented with a "welcome panel" (of type NSPanel) with buttons for common actions like "Create New Document" and "Open Existing Document". These actions are linked to the first responder's newDocument: and openDocument: actions, respectively, just like the matching items in the File menu.Everything works as expected...with three caveats:The welcome panel is not dismissed when creating or opening a new document.Document windows do not have focus when they are created.Op...Read more

cocoa - Problems with implementing Versions

I try to implement Versions in application that already written for Snow Leopard. It is an Document based application with SQLite storage. Each document saves as an SQLite db file. I have implemented appropriate methods in my NSPersistentDocument subclass: + (BOOL)autosavesInPlace {return YES;}+ (BOOL)preservesVersions {return YES;}Now I have new File menu in application with "Save a Version" etc. I create new document in my app, save it, make some changes, save again.. When I entering version browser I get: kCGErrorFailure: CGSDisplayID: Ap...Read more

cocoa - Showing a non-modal template chooser synchronously

I'm writing a Cocoa app using the document architecture. Whenever an untitled document is created in this app, the user should be shown a window that lets them pick a template and prompts for other information. Only one of these windows should show up at a time, and preferably it should be possible to interact with the rest of the application while the template chooser is visible. (This is how Pages behaves.)I've got most of this working by overriding -[NSDocumentController openUntitledDocumentAndDisplay:error:]:- (id)openUntitledDocumentAndD...Read more