cocoa

How do I get the representedObject from a view in an NSCollectionViewItem?

I have a view that gets used in each of my CollectionView's items. I have an IBOutlet to the CollectionViewItem from my view and I have that hooked up in Interface Builder. I want to access a value from the representedObject (which is a Core Data object) in my view code. Here is an example of what I'm trying to do -- access a sequence...

how to click a text with underline for showing a web?

I want to click a text on the panel with a underline and the text color is blue, and then show a web , I know how to show a web , but how to define the text , in nib when I put a label on the window , I found the label didn't respond for the action , when I put a button with no border I found that I didn't edit the text attribute of the ...

What is the basic difference between NSTimer, NSTask, NSThread and NSRunloop ?

What is the difference between NSTimer, NSTask, NSThread and NSRunloop and is there a guideline on when to use each of them? ...

NSZombie crashing app when enabled on the iPhone

I added NSZombieEnabled to my executable's environment in order to track down an object that I'm over releasing. What I'm finding now, is that a part of my app is crashing that never has crashed before, only when NSZombieEnabled is toggled on. The moment I disable it, no crash occurs. I need to do forensics on my code, but what can this...

Document-based app in one window

I need to develop a simple document-based application but using only one window, the documents should open in views separated by tabs. How can I achieve it? ...

Why does an NSView's frame method return the wrong results?

I occasionally want to change an NSView's dimensions programmaticaly. To do this, it is helpful to get the dimensions of various views, adjust them relative to each other, and then use setFrame: to reposition. The problem is that the frame method usually returns NSRects that are clearly wrong, from my perspective. I have a program wit...

Duplicating views

I want to create a view with some controls inside, a text field and some buttons, and I want to duplicate this to show them as content of a tab in a tabview. Each tab must has an instance of this view. Directions? ...

How do I integrate an Audio Unit to an app

How do I integrate an audio unit into an application. I may not be familiar with the concept of components. I can open them in AUlab but I want to use it with a main. ...

Cocoa variable declaration

Hi, can someone tell me why there is a * in the line? What does it mean for the declaration? NSString *someString; Thank you guys edit: Thank you it helps me a lot but sometimes i see declarations without * example: BOOL areTheyDifferent; why there is no pointer in this declaration? ...

Sort NSArray of date strings or objects

I have an NSArray that contains date strings like this: "Thu, 21 May 09 19:10:09 -0700" I need to sort the NSArray by date. I thought about converting the date string to an NSDate object first, but got stuck there on how to sort by the NSDate object. Thanks. ...

Objective-C best practices

Does anybody know a good reference about Objective-C/Cocoa Best Practices? Project organization, methodologies, naming and etc. ...

UITextFieldDelegate Protocol for a UIVewController

I went through this tutorial Your First iPhone Application and it worked great. My question is about the line in the tutorial that reads as follows: The view controller is also going to be the text field’s delegate; as such, it must adopt the UITextFieldDelegate protocol. To specify that a class adopts a protocol, in the interface a...

HAL - how to monitor audio output on a mac

There is an application called wiretap available at http://www.ambrosiasw.com/utilities/wiretap/ This application can record the system audio. I would like to be able to do the same in my program. Any insights on what I need to do this? I am familiar with Core Audio but havent found anything on how to do this. would this help getti...

Preload/predisplay tiles in a CATiledLayer?

On the iPhone (though I imagine it's an equally valid question in Cocoa) I have a UIScrollView around a UIView backed by a CATiledLayer. The way it works by default is to load any uncached/unfetched tiles when my viewport scrolls over a blank section of the CATiledLayer. What I would like to know is if there's a way to trigger CATiledLa...

Any way to install a bookmarlet in Mobile Safari from a native app?

Any way to install a bookmarlet in Mobile Safari from a native app? Has anyone been able to successfully do this? ...

NSWindowController circular dependency caused by bindings?

Suppose you have a window nib, owned by a NSWindowController which loads the nib. The NSWindowController has an IBOutlet bound (via Interface Builder) to a UI control on the window. Is it true that you can't dispose the window controller by releasing it because the binding causes a unbreakable circular dependency between the window co...

Cocoa Mail Framework

Hi Everyone: I am wondering if anyone knows of a good Cocoa Mail framework that is updated for Leopard. Nothing that I can find compiles on my system, and I need a integrated mail system (versus Mail.app). I have tried: EdMessage, Pantomime, and MailCore. Maybe I'm doing something that makes these not compile, and if so please let me ...

How to determine an array index in Objective C?

I have two arrays in Objective C and I need to find what index something is so I can insert it in the same place. For instance, lets say I have a "name array" and an "age array". How do I find out what index "charlie" is in the "name array" so I know where to insert his age in the "age" array? Thanks ...

Adding an object to an array read from a file

There is nothing in the file, but I add row1 to my array right after. NSLog tells me that the array is empty. Why isn't row1 added to the array? All of my other code is fine as far as I can tell. My app worked when I put hard values into the array. Now that I'm loading from a file, it doesn't work. - (void)viewDidLoad { //array value /...

How to encode/decode a reference to a selector?

I have a class with an instance variable of type SEL, which is a reference to a selector. Inside encodeWithCoder/initWithCoder, how do I encode/decode this type of variable? ...