cocoa

Locking details of synthesized atomic @properties in Obj-C 2.0

The documentation for properties in Obj-C 2.0 say that atomic properties use a lock internally, but it doesn't document the specifics of the lock. Does anybody know if this is a per-property lock, a per-object lock separate from the implicit one used by @synchronized(self), or the equivalent of @synchronized(self)? ...

Add to arrayController, edit Core Data attribute

EDIT What I'm not sure of is how to access an entity from the model in the code, and how to access a specific instance of an entity in that code. That sums up the main issues I'm having. END EDIT I have a tableview with a button to add to it. When the button is clicked, the user is presented with an open dialog where they select ...

NSTextFieldCell Coordinates

I'm trying to get the NSPoint cooridnates of an NSTextFieldCell, but NSTextFieldCell doesn't inherit from NSView, and therefore doesn't have the frame method. Any ideas on how to get around this? I'm trying to use Matt Gemmel's MAAttachedWindow to attach little helper popups to certain elements. I want to attach it to an area on the wi...

Easy way to make a UILabel cover and exactly match contents of a UITextField?

UI crimes aside... I'd like to have a UILabel replace a UITextField after some user input. Is there an easy way to accomplish this so when the UITextField is hidden its value gets replaced by a UILabel that doesn't appear to move...appearing to "set" into the background so to speak? I've managed to do this by nudging the fields around i...

Why are Objective-C delegates usually given the property assign instead of retain?

Hi all, I'm surfing through the wonderful blog maintained by Scott Stevenson, and I'm trying to understand a fundamental Objective-C concept of assigning delegates the 'assign' property vs 'retain'. Note, the both are the same in a garbage collected environment. I'm mostly concerned with a non-GC based environment (eg: iPhone). Directl...

How do I convert NSString with Hexvalue to binary char* ?

I have a long hex value stored as a NSString, something like: c12761787e93534f6c443be73be31312cbe343816c062a278f3818cb8363c701 How do I convert it back into a binary value stored as a char* ...

How would you make a Checkbox Cell only display on a Certain Entitys Rows in An Outline View?

I am looking to make a checkbox cell only displays it self on the child's row's inside the outline view, so when you drop down the parent the checkbox will appear for the child entity's rows. What would I need to do this? If this helps here is a Picture of the Entity Diagram: http://snapplr.com/phrn ...

UIPickerView not appearing until touch occurs

I'm programatically adding two custom UIPickerViews to another view (MainView). They work just fine but they are not visible until a touch event occurs in any part of the MainView. I've checked the class references for UIPickerView and UIView but haven't found anything that manages to "refresh" the view, unless I'm missing something obvi...

What's the best way to add a composite property for binding to an existing class

Let's say I have a Size class which has height and width properties (in reality the class is a bit more complex than this, but Size makes a good example). I want to display this as $width x $height in my UI. The obvious way to do this is to bind to a dimensions property which is dependent on width and height. My question is where is t...

What is the correct way to tell when an NSArrayController is finished loading its content from a persistent store?

What's the best way to know when my array controller that is bound to my core data store is done loading its content? I've got some methods (i.e. awakeFromNib) that rely on the array controller having its content, but most of the time the array controller doesn't have its content yet when awakeFromNib is being called on that object. ...

How do you add items to the "User Media" category in Interface Builder's "Library" window?

The "Library" window in Interface Builder provides a "Media" tab that lists various images and sound resources that you can refer to from your nib file. There is a "System Media" item that lists default images provided by OS X, and if your nib is part of an Xcode project, you can also browse through images/sounds included in your Xcode ...

How can I make a piece of code run in a separate thread?

I have a few method calls like this: [self myFoo]; [self heavyStuff]; // this one in other thread [self myBar]; which classes / methods do I have to look at? When I search for "thread", there comes a lot of classes, methods and functions. Which one's are most apropriate here? ...

Main thread's NSRunLoop being referenced in a secondary thread

Hi all, I was just recently futzing about with a sample application trying to get my head completely wrapped around NSRunLoop. The sample I wrote created a simple secondary thread via NSOperation. The secondary thread does a few tasks such as process an NSTimer and also some rudimentary streaming with NSStream. Both of these input sourc...

Populating Object in Objective C

I'm trying to populate a dictionary dynamically in a for loop like so: pseudo-code myObject = new Object myDict = new Dictionary for(int i; i < 10;i++) myObject.value1 = new data from somewhere myObject.value2 = new data from somewhere myDic = value:myObject key:i end for So my question is in objective-c, can I just keep assig...

How to expand and collapse parts of NSSplitView programatically?

Hi, I want to replace RBSplitView with NSSplitView in my existing project. The application is now leopard only and I would like to replace RBSplitView with the new NSSplitView shipped with Leopard. However, I'm missing RBSplitView's handy methods expand and collapse in NSSplitView. How can I expand and collapse parts of NSSplitView pr...

Cocoa Touch App Architecture - MVC controller?

I am quite new to Cocoa and to iPhone programming. I am using the Xcode Utility Application template to implement a simple app that has: a view with a text field to collect a username a view with a connect button to start a connection to a remote site using the username to get some data via HTTP. The data will be presented as a text ...

Threading in Objective-C

is there Thread in Objective c. if there how it is declare and use. if anybody know using multithreading in Objective -c ..pls share with me .. thanks and regards .. by raju.. ...

Objective-c: NSString to enum

So, I've got this definition: typedef enum { red = 1, blue = 2, white = 3 } car_colors; Then, I've got a variable of type car_colors: car_colors myCar; The question is, I receive the color of the car in a NSString. It must be a NSString, I can't change that. How can I convert from NSString to car_colors type? NSString ...

Core Data NSPredicate for relationships.

My object graph is simple. I've a feedentry object that stores info about RSS feeds and a relationship called Tag that links to "TagValues" object. Both the relation (to and inverse) are to-many. i.e, a feed can have multiple tags and a tag can be associated to multiple feeds. I referred to http://stackoverflow.com/questions/844162/how...

Creating a bundle - What's going wrong?

Hello everyone, I've got a relatively simple one here. I'm making bundles to live inside the Resources folder of my application (and possibly in the Application Support folder). These bundles will contain template information for the data the application handles. I've constructed a bundle, with extension "booksprintstyle", and the direct...