cocoa

Should I nil delegate references made through Interface Builder?

If I assign a delegate property from classB to classA from Interface Builder, should I assign an IBOutlet to classB, then in classA dealloc, set the delegate to nil via the outlet? (Assuming classA is the file's owner of the XIB...) ...

Why are certain lines in my Cocoa application taking forever to run?

I'm having a very strange problem. I'm running a loop in a detached thread, and some lines of code in my loop (different lines in each iteration of the loop) are taking a long long time (~45 seconds) to execute, even if they are simple commands like initializing an NSXMLDocument with data. This problem is also very inconsistent, and it d...

Cocoa: Create draggable zones

How can I create draggable zones in cocoa and be able to drag and drop images between the two. Ex: Zone 1:no image Zone 2:image drag zone 2's image to zone 1, and be able to save (core data) the location of the image. Would I have to do something like this: http://developer.apple.com/Mac/library/documentation/Cocoa/Conceptual/Dragan...

Setting text for NSTextView with an NSString variable, considering reference counting

I have the following code in a function in my .m file: desc = [my executeFunction]; // desc is returned by executeFunction data = [desc objectAtIndex:0]; // data is declared in the .h file data2 = [desc objectAtIndex:1]; [myTextField setString:data]; // myTextField is connected to an NSTextView in IB [myTextField setString:da...

Creating a view like iTunes's lyrics view in Cocoa

How do I create a scrolling text view like iTunes's lyrics view in Interface Builder for Cocoa? ...

Objective-C / Cocoa: Uploading Images, Working Memory, And Storage.

Hello. I'm in the process of porting an application originally in java to cocoa, but I'm rewriting it to make it much better, since I prefer cocoa a lot anyway. One of the problems I had in the application, was that when you uploaded images to it, I had the images created, (as say an NSImage object) and then I just had them sitting in ...

Cocoa window position anomaly

Hello everyone, I have a weird problem with positioning a window on screen. I want to center the window on the screen, but i don't know how to do that. Here's what i've got. The window is created from nib by the main controller: IdentFormController *ftf = [[IdentFormController alloc] initWithWindowNibName:@"IdentForm"]; [[ftf window] m...

Why "add subview" not work?

Hello, I try add subview but not work. My code is: HomeViewController* homeViewController = [[HomeViewController alloc] initWithNibName:@"HomeView" bundle:nil]; NSViewController *viewController = homeViewController; [mainView addSubview: [viewController view]]; NSLog(@"%@",[viewController view]); NSLog(@"%@",[[viewController view]superv...

How do I convert from NSString to NSDate?

how to convert from NSString to NSDate ? it must be in yyyy-MM-dd HH:mm:ss this format when it converts from NSString to NSDate format ...

Cocoa touch view with multiple identical subviews

I'm having my first foray into Cocoa Touch programming (and one of my first into Cocoa in general) and writing a simple game for the iPhone, though this question is about cocoa touch in general. The main UI consists of a strip of identical acting buttons (only varying in colour) arranged horizontally across the screen. Although they act...

Simple NSSpeechRecognizer code, not working!

Hi all, I noticed NSSpeechRecognizer in ADC library and I found it to be very interesting, so to play with it I prepared a simple application which will just listen the command and if recognized it displays it in log. The code used is: - (id)init { if (self = [super init]) { // Insert code here to initialize your applicat...

What is "float_t" for?

Should I be using float_t instead of float? ...

CoreData unique objects by attribute

Hello, I have a graph with one kind of object called Message. A message could have childs so the graph is a tree. Each object on the graph contains an attribute value; that's a sort of UUID (globally unique) so the store cannot contains multiple messages with the same UUID (this uuid is a string taken from message data so I can't replace...

How to get selected item of NSOutlineView without using NSTreeController?

How do I get the selected item of an NSOutlineView with using my own data source. I see I can get selectedRow but it returns a row ID relative to the state of the outline. The only way to do it is to track the expanded collapsed state of the items, but that seems ridiculous. I was hoping for something like: array = [outlineViewOutlet s...

Does Instruments' memory leak tool have issues with 'for' loops?

Running my app in the simulator under Instruments to check for memory leaks, it seems to be indicating a leak in this block of code: for (NSDictionary *messageDict in messageDataArray) { message = [[Message alloc] init]; ... set some properties on the 'message' object [messages addObject:message]; [message release]; } ...

Why does NSDateFormatter return nil?

Why is lDateFormatted nil on iPhone simulator 3.1.2 after executing this piece of code? NSString *lDateString = @"Wed, 17 Feb 2010 16:02:01"; NSDateFormatter* dateFormatter = [[[NSDateFormatter alloc] init] autorelease]; [dateFormatter setDateFormat:@"EEE, dd MMM yyyy hh:mm:ss"]; NSDate *lDateFormatted = [dateFormatter dateFromString: l...

Loading a nib file without a NSWindowController?

I have a nib file I want to open up, but it is just an info panel so I dont need any methods for it. Is there a way I can just open it. I am not in a class that is a subclass of NSWindowController. ...

Calling Javascript from Objective-C via WebScriptObject

Hello, I decided I would change how I implement printing in my Cocoa app by having my app provide string-data to a webpage in an embedded webview, and then I would print that webview/frame. The problem is that my code isn't being called and I don't see an error being returned. Here is the setup: 1) Use Dashcode and build a webpage. ...

Customizing UITabBarController

Hi! I need to change font size and background color of the list displayed by "More" button of the UITabBarController. Is it possible ? How can I do it ? Thanks a lot. ...

How to get a CodeSignature for a Mac OS X app

Hey! I think this is a simple question for you. Most of the system apps and also some third-party apps have integrated a CodeSignature in their bundle. I heard with such a CodeSignature the system would not ask anymore for accepting incoming network connections (if the firewall is enabled). Now the question is where to get such a CodeSig...