cocoa

Override decidePolicyForNavigationAction what next?

In my first view I've overridden decidePolicyForNavigationAction, now I want to pass 'request' to another view that will be pushed onto the navigationController stack, which will display the content from the url in a uiwebview My problem, I think, is pushing the next view onto the stack, I keep getting 'request for member 'navigationCon...

ASIHTTPRequest swallows up my NSOperation variables in synchronous mode

Hey I have been battling with this problem for a while now. Perhaps there is something I am missing in knowledge about multi threading but here is what happens. When I create an nsoperation queue any variables that are allocated become cleared after the "[request startSynchronous];" line of code. Here is what I'm talking about: @impleme...

Unable to write to NSTextField from Model Controller object

After always running monolithic blocks of code from within my AppController object, I've just learned how to modularize my code using separate model controller objects (so much neater and less confusing to work with :-)) My simple test app has a main AppController and two model objects (Model1 and Model2). I can successfully pass data f...

Cocoa bindings: get old value upon change

I am writing a core data Cocoa application in which there are accounts and transactions (monetary). The account entity description contains a balance attribute. The transaction entity description has a relationship to an account. I need the application to update account balances when transactions have their accounts set or changed. For ...

Is Locking really needed in my iPhone application?

I'm working on a relatively simple iPhone application that has a multi-round Timer with a number of settings such as the number of rounds and round length. We allow certain settings to be upated while the timer is running which means the timer may be reading from the same memory that the settings are writing. There are no critical sect...

How to auto close modal window in Cocoa ?

I tried this but my program crashed. - (void)windowWillClose:(NSNotification *)notification { [modalWindow orderOut:self]; [NSApp stopModal]; } Thanks in advance. ...

NSPredicateEditorRowTemplate and CoreData

I am trying to generate predicate editor templates for my Core Data entities. In my code I have the following: NSEntityDescription *descrip = [NSEntityDescription entityForName:@"Person" inManagedObjectContext:managedObjectContext]; NSArray *templates = [NSPredicateEditorRowTemplate templatesWithAttributeKeyPaths:[NSArray arrayWithO...

How To CustomToken - Cocoa with Objective-C or MacRuby

I try to build an Input which is able to show one or more Token at the beginning of line. You can see an example what I'm trying to receive in the image below. (screenshot shows google-macsearch) http://www.freeimagehosting.net/uploads/4a268855a0.jpg Cocoa provides the NSToken class, but I like to do it by myself and custom, but I don'...

how to check repetition of numbers in an array?

I generate random numbers and store them in an array. int RandomNumber = arc4random() % 12; [NSMutablearray *Number addObject:[NSNumber numberWithInt:RandomNumber]]; Now i want to make sure the same number is not created randomly again. Can any one please tell me how to do it with sample code. ...

Coding a Mac OS X terminal emulator?

Hi, I'd like to create a terminal emulator for Mac OS X. The problem is: I have no idea where to start. Can I just use a whole bunch of NSTasks? Or do I have to read through tons of source code for programs like xterm, urxvt, etc? I don't want a lot of customizability (= no config file parsing), nor complex features, and I'm only gonna ...

Reorder NSOperationQueue

I'm looking for a way to reorder an NSOperationQueue. I could cancel all the operations and toss them back in using the order I want, but I was hoping for something a little bit cleaner. Any thoughts? ...

Store int32_t in an NSDictionary

Hi, How can I store a variable of type int32_t (e.g. for ABPropertyID) in an NSDictionary? [NSNumber numberWithInt:...] doesn't seem to work. Thanks From the comments: NSLog(@" %@ %@ ", [NSNumber numberWithLong:kABPersonFirstNameProperty], kABPersonFirstNameProperty); Prints: 0 (null) Any ideas? ...

Checkbox on table column won't register click

Hi, I've a table view to which I add columns dynamically. It must be done this way because I can't predict how many or which columns I will need. Some columns are checkboxes but I can't click on them when I run my application. The column and checkbox are set to be editable but if I click on the checkbox the check won't get set. Am I m...

Minimum steps to display a table-view in Cocoa OSX

Hi I am trying to create a table-view programatically using a cocoa lisp bridge called clozure CL. Now I doubt many people are familiar with this package so I will not go into specifics of my code but I am getting some very strange errors when I try to call addSubview to add my tableView to my window. I have initialized it using InitWi...

NSPopUpButton: events from menu tracking?

Is it possible to detect actions that tell my controller when the user is mousing (or otherwise perusing) the items in an NSPopUpButton? I only seem to be notified on a new selection and I'd like to be notified as the user is rolling over any item in the menu. thanks tom ...

Custom Modal Window with Block Completion Handler

Hey Guys! I'm stuck! I am trying to create a custom modal dialog. I would like it to perform similarly to the NSSavePanel using a block as a completion handler. I've copied only the important snippets I think are needed. @implementation ModalWindowController - (void)makeKeyAndOrderFront:(id)sender modalToWindow...

NSXMLDocument's initWithContentsOfURL is sometimes really slow on loading a URL's contents

As the title says, some URLs take less than a second to load in the browser, but in my cocoa app, running the following line repeatedly results in initWithContentsOfURL sometimes taking up to 30 seconds to load the URL. What may be the source of this problem? I'm calling it like this: NSXMLDocument* aDoc = [[NSXMLDocument alloc] initWi...

Is there a conventional method for inverting NSColor values?

I'm looking for a way to invert arbitrary NSColor values at runtime, and there doesn't appear to be any built-in method to do so. I will be using a category to extend NSColor as follows: NSColor * invertedColor = [someOtherColor inverted]; Here is the category method prototype that I am using: @implementation NSColor (MyCategories) ...

deriving from NSTabViewItem

I'm writing a Cocoa app. One dialog has 3 tabs, some of the tabs needs more loading time, so I want to load them lazily. Since each Tab is a NSTabViewItem class, so I'm trying to derive from it and overriding its view property. In the view getter method, I use a ViewController to load a view and returns out. In Debugging, I found NSTabVi...

JAVA_HOME is not defined correctly Error while compiling

Hi, I am developing an aplication in cocoa which uses some java classes .I am getting an error "JAVA_HOME is not defined correctly We cannot execute /System/Library/Frameworks/JavaVM.framework/Home/bin/java".I dont know how to resolve this..Please anyone help me.. Thanks in advance ...