cocoa

Using Core Text for input

I'd like to make a rich text type editor using Core Text (ideally for iPad but I'm pretty sure I can't get iPad specific examples due to the NDA) I have no idea really where to start. I'd like to keep the interaction models without having to rewrite them, so would I be layering stuff on top of a text view? Then how do I keep the overlay...

Any good pubsub.framework guides?

Are there any good guides on how to use pubsub.framework? Apple's documentation is scarce and the sample code that they give you is impossible to follow ...

Getting argument values from NSInvocation

Could someone please explain how to go about getting the values passed to a non-existant method that is being intercepted when using: + (void)forwardInvocation:(NSInvocation *)anInvocation; + (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector; Given a message like: [SomeClass doSomething:@"theThing" withSomething:@"aPar...

Number of occurrences of a substring in an NSString?

How can I get the number of times an NSString (for example, @"cake") appears in a larger NSString (for example, @"Cheesecake, apple cake, and cherry pie")? I need to do this on a lot of strings, so whatever method I use would need to be relatively fast. Thanks! ...

How to Copy Folder to System folder in Cocoa

Hi, I am developing an application in cocoa which needs to copy a set of files to the system folder. When copying files to system folder I am getting a "Permission denied " error message . How can I resolve this problem. Please any one help me... Thanks in advance ...

Create simple cocoa application wrapper

I have an application I want to bundle (with some additional files) together inside a wrapper application. Literally the only thing I want to do is have the wrapper application launch a resource file (i.e. as if I'd typed: /path/to/Resources/Bundled.app/Contents/MacOS/executable into the terminal. Make sense? I thought this should b...

Delegate problem with NSTextField

Hi... I am just starting with OSX development, and I am trying to get delegate notifications from a NSTextField. I've got the following code so far: This is where I set the delegate: - (void) awakeFromNib { NSLog(@"Setting delegate"); [amountField setDelegate: [[TextfieldController alloc] initWithLog]]; } And this is my Text...

High-resolution icon for file in Mac OS X?

I am looking for a method exactly like -[NSWorkspace iconForFile:] but which returns the icon in a higher resolution if possible. In particular, I have an app which makes use of QuickLook to display previews of files, and I'd like it to fall back to the file icon if no quick look plugin is available. Using the iconForFile: method, howe...

Cocoa CurrencyConverter sample app, adding Currency formatter to dollar field

The CurrencyConverter sample Cocoa application uses unformatted text fields in the interface, and pulls the values using floatValue in the controller. I added a formatter (to Currency) to the input dollar amount field, but this breaks the application. I'm just learning Cocoa, and am assuming "floatValue" cannot handle the $ sign at the...

Right-click on a NSStatusItem

Hi. I have a NSStatusItem and I want to popup a menu by rightclicking the item. I subclassed a NSView and overwrote the - (void)rightMouseDown:(NSEvent *)event method. I also implemented - (void)mouseDown:(NSEvent *)event for looking at the modifierflags. My problem is, that the view does not recieve the NSRightMouseDown-Event. And I don...

NSTableView not displaying data

Here's my code: test.h @interface testAppDelegate : NSObject <NSApplicationDelegate> { NSWindow *window; IBOutlet NSTableView *test; NSMutableArray *internalArray; } @property (assign) IBOutlet NSWindow *window; @property (nonatomic, retain) NSTableView *test; -(id) initWithArray: (NSArray*) objects; -(int)numberOfRowsInTa...

set file's icon in a command line utility not working

I just began to work with Objective-C and I'm managing pretty well. My last challenge was to make a command line utility, which I could than use in AppleScript. But my code does not work, not in the terminal, not in the AppleScript. So I'm asking you, what's the error in this peace of code, that should be very plain and easy? int main(i...

Mac Quick Look Preview in an NSView or NSImage?

I am looking for a way (public or otherwise) to get an NSView, NSImage, CGImageRef, etc that shows the QuickLook preview for a file. Essentially the equivalent of QLThumbnailImageCreate() but for the preview. The public APIs I can find do not support this. They allow the creation of a thumbnail image or a QLPreviewPanel. The panel do...

Cocoa OpenGL window in pure C?

I want to open an OpenGL window ( to display and grab keystrokes / mouse events ) in MacOSX. I don't want to use Glut (since it demandds it be the root thread). I don't want to learn Objective C. Is there anyway to access the OpenGL api in pure C? Thanks! ...

Making a copy of a NSManagedObject which isn't managed.

So my problem is that I have a NSManagedObject 'A' which has a has-many relationship to 'b'. So for each object of 'A', there can be many 'b'. Now, I want to make a copy of 'b', so that 'b' can be modified, but not saved to the store, but 'A' can be saved'. For example, self.title = A.name; setOfB = A.setOfb; // This is still managed...

How should I handle errors in an API?

I am writing an API that wraps some core foundation web functionality that can return a number of possible error conditions. I am struggling with deciding the best way to handle error conditions that the API consumer should deal with (like network timeouts, receiving unexpected results, malformed XML, etc). I have come up with 3 differen...

What cocoa applications are using the AquaticPrime Licensing System?

I'm thinking about using the AquaticPrime licensing system for my new mac app. Is the framework popular? What apps are using it? ...

is EDMessage.framework thread safe?

Hey, I didn't see this anywhere in their FAQ and wanted to know if EDMessage.framework [ http://www.mulle-kybernetik.com/software/EDFrameworks/ ] is thread safe. If it matters, I'd be sending out bulk quantities of html emails. I am currently sending each email one at a time on a non-main thread. Also, from the looks of the info on it...

File size in Snow Leopard

Hello there! I'm trying to figure out how to convert a file's (or directory's) byte size into kilobytes, megabytes, gigabytes, etc... respectively according the file's or directory's size so that is matches what the Finder displays in the panel when you hit "Get Info". The byte size I get perfectly matches the byte size as reported in...

[self.managedObjectContext deleteObject:self];

[self.managedObjectContext deleteObject:self]; Is there a problem, conceptually, with executing this line of code? ...