cocoa

Another IKImageView Question: copying a region

I'm trying to use the select and copy feature of the IKImageView. If all you want to do is have an app with an image, select a portion and copy it to the clipboard, it's easy. You set the copy menu pick to the first responder's copy:(id) method and magically everything works. However, if you want something more complicated, like you wan...

creating NSimage from NSbitmapRep from int* using NSData?

I have an int* of rgb data,width, height, and scanlinestride where i would like to create an NSImage. i have looked around and found that i need to use NSData? what is the ideal way of doing this? ...

How to debug 'no entities specified' when working with ZSync and CoreData Syncing

I'm trying to get ZSync to work between a desktop and iPhone app. I've got my schemas set up and all info matches between my MOM and my schema so I should be good to go. When I initiate my sync, however, I get this error. |Miscellaneous|Error| SyncServices precondition failure in [ISyncSession _validateClient:entityNames:beforeD...

Is NSDictionary key order guaranteed the same as initialized if it never changes?

I've run into the same problem as found in this question. However, I have a follow-up question. I seem to be in the same situation as the original asker: I have a plist with a hierarchy of dictionaries that define a configuration screen. These are not mutable and will stay the same throughout the application. Since the original discussio...

Glow around Button

How can I draw a slight white 'glow' around a button or label in 10.5 and later? I have seen some apps do it, but I am still confused how I should do this. ...

How to configure a NSPopupButton for displaying multiple values in a TableView?

Hi there! I'm using two entities A and B with to-many-to-many relationship. Lets say I got an entity A with attribute aAttrib and a to-many relationship aRelat to another entity B with attribute bAttrib and a to-many relationship bRelat with entity A. Now I am building an interface with two tables one for entity A and another for entit...

How to get correct Set-Cookie headers for NSHTTPURLResponse?

I want to use the following code to login to a website which returns its cookie information in the following manner: Set-Cookie: 19231234 Set-Cookie: u2am1342340 Set-Cookie: owwjera I'm using the following code to log in to the site, but the print statement at the end doesn't output anything about "set-cookie". On Snow leopard, the li...

Is it dangerous to set off an autoreleased NSOperationQueue?

I have a task that takes a rather long time and should run in the background. According to the documentation, this can be done using an NSOperationQueue. However, I do not want to keep a class-global copy of the NSOperationQueue since I really only use it for that one task. Hence, I just set it to autorelease and hope that it won't get r...

Does Cocoa’s printf-style formatting not work as expected when using %@ conversion specifier and field width?

My understanding of printf-like format strings is that you can prefix any conversion specifier with a minimum field width. This does not seem to work for Cocoa’s %@ specifier. Example: NSLog(@"'%5@'", @"foo"); NSLog(@"'%5s'", [@"foo" UTF8String]); Output: … 'foo' … ' foo' Is this the intended behavior? ...

Where is NSTextfield Validates Immediately?

I have set it before but I cannot find the option any more... ...

writing NSDictionary to plist in my app bundle

Hi I'm trying to write an NSDictionary to a plist but when I open the plist no data has been written to it. From the log my path looks correct and my code is pretty standard. Any ideas? NSArray *keys = [NSArray arrayWithObjects:@"key1", @"key2", @"key3", nil]; NSArray *objects = [NSArray arrayWithObjects:@"value1", @"value2", @"value3...

How expensive is it to create an NSAutoreleasePool

I have a method which needs to run in its own thread 88 times per second (it's a callback for an audio unit.) Should I avoid creating an NSAutoreleasePool each time it's called? ...

Best practice - Accessing preferences globally

User preferences for my app is store in NSUserDefaults. This includes a "theme" preference, which needs to be accessed frequently by multiple classes. I would prefer not to call "[[NSUserDefaults standardUserDefaults] objectForKey:..." repeatedly as it makes for inconcise code and I assume will incur overhead. What is the preferred and m...

For what programs are Objective C and Ruby ideal on the Mac?

Hi, as a Mac outsider it seems that two popular programming languages on the Mac appear to be Objective C and Ruby. From what I understand the main API Cocoa seems to be written in and optimized for Objective C, but it is also possible to use Ruby for that. Are there different areas where each language is ideal, for example, I could im...

EXC_BAD_INSTRUCTION (SIGILL) at random during use of app. Bug in AppKit?

I'm currently testing a new version of an app of mine on OSX 10.5 An user reported some weird crashes during use of the application, sadly not reproducible by me. At first sight it seems to happen randomly, once he had the crash while opening an NSOpenPanel and once during focusing an NSTextField and once during NSView switch in a parent...

NSPredicate and arrays

Hello, I've got a short question. I have an NSArray filled with Cars (inherits from NSObject) Car has the @property NSString *engine (also regarded @synthesize ...) Now I want tu filter the array using NSPredicate predicate = [NSPredicate predicateWithFormat:[NSString stringWithFormat:@"(engine like %@)", searchText]]; newArray = [Arra...

Different cells in NSTableView together with bindings

Hi, im working on a nstableview that contains information for some properties that are dynamicly created. Each row contains some cells that are common (name for example), but in one column they have different cells. Some properties will have NSSliderCell, other NSButtonCell etc. All of this is binded up to a NSDictionaryController. I've ...

How do I update a progress bar in Cocoa during a long running loop?

Hi, I've got a while loop, that runs for many seconds and that's why I want to update a progress bar (NSProgressIndicator) during that process, but it updates only once after the loop has finished. The same happens if I want to update a label text, by the way. I believe, my loop prevents other things of that application to happen. Ther...

NSNotification race condition

Are there any race condition issues when using NSNotifications within a single thread? Here is a sample method: - (void) playerToggled: (NSNotification *) notification { if (timerPane.playing && ! timerPane.paused) { [playerPane toggleCurrentPlayer]; [timerPane toggleTimer]; [mainPane playerToggled]; } } The first two ca...

Programmatical Creation of NSMappingModel

I want to programmatically (without Lightweight Migration) create a mapping model between two models that are exactly the same, except one of the entities (there are a bunch of entities) has different attributes. Let's call this entity "Person". And let's say the destination model has 1) added a new attribute called "address" 2) delete...