cocoa

Table view not updating according to bindings

This is a very newbie question, and this is something I have done many times before, but there's something I'm missing this time. In my AppDelegate.h file I declare an NSArray and set it as a property: @interface AppDelegate : NSObject { NSArray *lines; } @property(readwrite, retain) NSArray *lines; @end And then in the AppDelegate...

nswindowcontroller + program execution

Hi Guys I am trying to use nswindows controller to handle user inputs during the program execution. I am able to get the user input in a nstextfield but when i am clicking on the ok or cancel button, their respective IBAction methods are getting executed and the control is not getting returned to the previous execution place that should...

Cross-user and cross-process shared settings

I have two processes - a user process and a root-level LaunchDaemon. I'd like both processes to have shared settings. I've tried getting this to work via a sqlite database, but have run into corruption issues. I've thought about using NSUserDefaults, but the NSGlobalDomain seems to only be global for the user, and I need a cross-user ...

Adding sqlite framework to desktop Mac app.

I'm using Xcode 3.1.3 to create a desktop Mac OS X 10.5.7 app. I'd like to use sqlite in the app but can't find the framework reference in the MacOSX10.5.sdk folder. I've used sqlite in iPhone apps and the reference comes from the iPhone sdk folders. Should I just reference the iPhone sqlite framework version or is the desktop version...

Cocoa: I've got my user's input - Now what?

In a nutshell what my program does is: it executes and takes user input periodically using nswindow (which is controlled by my NSWindowController object) and continues execution. here is my myController.mm which is calling and showing the window to take user input: EncryptPasswordDlgController encPassController = [[EncryptPasswordDlgC...

How to call the method that would have been called if the delegate weren't there

I am implementing an optional delegate method on the Cocoa Touch API. What I would like to do is, first call the method that would have been called if I didn't implement the delegate ... then make changes to the result ... then return my modified version. Here's an example: - (UIView *)tableView:(UITableView *)tableView viewForHeaderIn...

NSThread, NSTimer and AutoreleasePools in an iPhone SDK application

Hello every one, I want to create an appilication in iPhone in which I want to use NSThread. I have created one thread using [NSThread detachNewThreadSelector:@selector(doThread:) toTarget:self withObject:nil]; I want that my one thread will handle all the touches and other user interaction and the second thre...

Observing NSTreeController's bound CoreData entities for insertion/removal

I am creating my own bindable custom treeview. For that I would like to observe NSTreeController for updates to its items' to-many-relationships. NSTreeController is bound to CD managed object context. Every depth level has its own CD Entity with parent/children/isLeaf properties. I need to maintain same hierarcy in the view (and order o...

VPN in cocoa app

Is it possible to setup a vpn connection in my cocoa app or from a commandline? And where should i start if i want to do something like that? ...

How can I find out the type of a NSDictionary element?

How can I find out the type of a NSDictionary element? ...

Allocating memory for NSString?

I am new to Objective-C and I am a little curious about how I should be managing the memory for the local NSString variables shown below and the associated instance variables inside the class object. The code I have works fine, but just curious as to best practice. Edited to include full code, nothing special, like I say I am just curio...

No results in Spotlight in searches against kMDItemPath

I am trying to create a Spotlight query that searches for a string in the path of a file (I would like it to match in either the name of the file or the name of any of the folders is contained in). NSPredicate *predicateTemplate = [NSPredicate predicateWithFormat: @"kMDItemPath like[wcd] $SEARCH"; [query setPredicate: [predicateTem...

Making an NSButton inactive.

What I want to do is as simple as hide a button. Currently I have used the code … [myButton setTransparent:TRUE] … that works BUT if you click where the button is and even though it's hidden whatever it's action is still happens. Is there a way to disable the NSButton? ...

NSURLDownload resumedata encoding

Hi, I have been trying to figure out recently the data encoding used for the resumedata of an NSURLDownload. My situation requires me to create the resume data myself and use that to create a download. The reason for this is because the ETag is not always available from the server. While I am extremely hesitant to use the private API, I...

sleep time into for loop

Hi: I need to make a for loop and between every loop wait 2 seconds and continue for (int i = 0; i < [stories count]; i++) { //my code //sleep 2 seconds and continue } How can I do this? ...

What kind of category methods do you use to make Cocoa programming easier?

I use a collection of category methods for Cocoa's built in classes to make my life easier. I'll post some examples, but I really want to see what other coders have come up with. What kind of handy category methods are you using? Example #1: @implementation NSColor (MyCategories) + (NSColor *)colorWithCode:(long)code { return [NSCo...

motionBegan: Not Working

Hi Everyone: I am running into a bit of a problem when I attempt to use (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event in order to capture a shake event. The problem is that the function isn't even running, even when I override canBecomeFirstResponder and set it to return YES. I have seen some other people's posts...

Load SWF inside NSView

Is there any way to load a swf file and display it in a NSView? ...

Modal custom sheet not closing

Hi Guys I am trying to display a custom modal dialogue box and am doing it the following way: EncPasswordSheet is of IBOutlet NSWindow * type. @implementation EncryptionPasswordSheet -(id)init { return self; } (void)showCustomDlg:(NSWindow *)window { if (!EncPasswordSheet) { [NSBundle loadNibNamed: @"EncryptionPasswordDlg" ow...

Converting enum into a class hierarchy

Let's say I am writing a class in Cocoa to act as a proxy to a server. To represent the current state of the connection, consider the enumeration: enum { MyConnectionStatusDisconnected = 0, MyConnectionStatusConnecting, MyConnectionStatusConnected, MyConnectionStatusCount }; typedef NSUInteger MyConnectionStatus; I may...