cocoa

Assign TableView column binding to a specific core-data object in to-many related entity based on separate attribute

How would I assign a column of a TableView to be a specific entry in a Core Data entity that is linked to the NSArrayController via a to-many relationship? For example Entity: MovieEntity Attributes: title(NSString), releaseDate(NSDate) Relationship: posters<-->> PosterEntity Entity:PosterEntity Attributes: imageLocation(NSURL), defau...

How can I easily save the Window size and position state using Obj-C?

What is the best way to remember the Windows position between application loads using Obj-C? I am using Interface Builder for the interface, is it possible to do this with bindings. What is the recommended method? Thank you. ...

NSTextFieldCell or just NSCell with vertical text (and colored tinting)

I'm struggling with trying to find an elegant way of displaying the column headers for a table view in a vertical fashion (rotated 90 deg counter clockwise from traditional). I'm not married to doing this as an actual NSTableHeaderCell, I figured it might be easier to do it by overriding NSTextFieldCell or NSCell. The cells only contai...

NSScrollView frame and flipped documentView

Hi, I have problems with NSScrollView, It is not displayed the way I want. Yes I know there is a lot of post about it around the web, I need to override the isFlipped, in order to make it return YES, in my NSView subclass. Ok, it's done, so now, my scrollView scroll from top to bottom, and not in the reverse way, as it was before overr...

does copyWithZone on an NSArray call copyWithZone on its elements too?

Hi, here's the scenario, I have this array of Person objects. copyWithZone is implemented on Person and works as expected. I have an array of Person objects, however when I create a copy of the array and modify things in original array (change attributes of a Person) it changes the copy as well. So my best guess is that when I call copy...

how to create a black rounded-corners window in cocoa

Hi, How to create a rounded corners black window in cocoa? Is it standard and can be created by IB? Can somebody provide an example? Thanks in advance ...

How would I write the following applescript in Obj-C AppScript? ASTranslate was of no help =(

The translation tool isn't able to translate this working code. I copied it out of a working script. set pathToTemp to (POSIX path of ((path to desktop) as string)) -- change jpg to pict tell application "Image Events" try launch set albumArt to open file (pathToTemp & "albumart.jpg") save albumArt...

save the text on coreData

Hi I am new iphone development. In my app, i am using two textfield and i want to save the text on the dada base which is entered in textfield then i want to display it. Here i am using CoreData base. I am feeling difficult to understand all classes on the coreData base. Here i am created view based application. What are the classes req...

Smart way to search an array of arrays

I have an array of arrays with objects and now want to get all objects for a certain date (which is an object property). what's the best way to query it? ...

On OSX, how do I gradient fill a path stroke?

Using the plethora of drawing functions in Cocoa or Quartz it's rather easy to draw paths, and fill them using a gradient. I can't seem to find an acceptable way however, to 'stroke'-draw a path with a line width of a few pixels and fill this stroke using a gradient. How is this done? Edit: Apparently the question wasn't clear enough. T...

List of already used objective-c Prefixes

I'm looking to choose a namespace for a library I'm writing and I'd like to avoid conflicts with other namespaces. Does anyone know of a website that lists all of the class prefixes in use? ...

How can I use OCMock to verify that a method is never called?

At my day job I've been spoiled with Mockito's never() verification, which can confirm that a mock method is never called. Is there some way to accomplish the same thing using Objective-C and OCMock? I've been using the code below, which works but it feels like a hack. I'm hoping there's a better way... - (void)testSomeMethodIsNeverCal...

KVO says that a KVO observer is registered even though it is not (or is it?).

When my application is closed, the main controller class removes itself as Observer from the model and then releases the model. Like this: - (void)dealloc { [theModel removeObserver:self forKeyPath:@"myValue"]; [theModel release]; [super dealloc]; } And right after that, the debugger says: 2010-04-29 ...

How do I track down the source of a KVC exception: this class is not key value coding-compliant for the key toolbar?

I get this error when I try to run my app: 2010-04-29 13:49:01.355 MyApp[56123:207] *** Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[<MyViewController 0x5112b10> setValue:forUndefinedKey:]: this class is not key value coding-compliant for the key toolbar.' MyViewController used to have an IBOutlet call...

NSPredicate that is the equivalent of SQL's LIKE

I'm looking for a way to use NSPredicate to set a LIKE condition to fetch objects. In addition to that, an OR would be useful as well. I'm trying to do something where if a user searches "James" I can write an NSPredicate that will do the equivalent of: select * from users where firstname LIKE '%James%' OR lastname LIKE '%James%'; ...

Any good way to set the exit status of a Cocoa application?

I have a Cocoa app which interacts with a server and displays a GUI. If there is a fatal error, I display an alert and exit. I'd like to set the exit status to a non-zero value to reflect that an error occurred, for ease of interaction with some other UNIX based tools. Unfortunately I've been unable to find a good way to do so - NSAppli...

How do I implement TimeOut in idarkstar?

Hi, A little background on the question: I am developing a RedDwarf(http://reddwarfserver.org/) client on iphone, for the client/server communication I use idarkstar. I had to make minor modifications to make it work till now. So here's the question, if the server is taking to long to respond or the network is very slow, how do I add a...

How to decode a urlstring in the right way in cocoa-touch?

My encoded string from the server looks like this: "it-strategy%20RZ%20U%20texas". How is it possible to decode this string back to "it-strategy RZ U texas"? I have tried the method stringByReplacingPercentEscapesUsingEncoding: , but I have still the percentages. ...

What are the constraints on Cocoa Framework version numbers?

We're distributing a Cocoa framework with regular updates. We'll be updating the version numbers with each release. The Apple documentation appears to suggest that version numbers should be consecutive incrementing integers. We are distributing output in several formats, and the framework is only one of them. We would rather not have to ...

Where to add an observer to the NotificationCenter in a UITableViewController

I want to send a notification from a UITableViewController-A to UITableViewController-B. I was adding the observer in the initwithCoder of the UITableViewController that is supposed to catch the notifications. The classes are correlated as folows RootViewController ===NavigationController-A =====UITableViewController-A ===Navigati...