cocoa

How to use standard symbols in NSMenu?

Reffering to Apple'S HIG on Menu, "Using Symbols in Menu" http://developer.apple.com/mac/library/DOCUMENTATION/UserExperience/Conceptual/AppleHIGuidelines/XHIGMenus/XHIGMenus.html#//apple%5Fref/doc/uid/TP30000356-TPXREF125 How do I use those standard symbols for my menu itmes? Well I just need example code or some example to get starte...

How do I find the size of my Core Data persistent store and the free space on the file system?

I am working on a database application using the Core Data framework. In this application I need to display how much data the application currently is using on the iPhone. Is there any way to do this? ...

NSTableView - toggling between 2 datasources.

I have a small cocoa app, and the UI consists mainly of a single NSTableView. However I have 2 different lists of data that I would like to display in it, and then just toggle between the two. My question is, what do you think is the best way to implement this? Now I figure I could use a BOOL flag to change which Array gets used in the ...

NSNetservice IP address

Hi, I'm using NSNetservice for my client-to-client application then now I want to hard code the IP address of the client who I want to send. Means instead of searching for their domains, I want to hard code inside my code. Do anyone knows? Thankz ...

How exactly is NSPrintInfo's sharedPrintInfo shared?

Apple's documentation for NSPrintInfo states in part: A shared NSPrintInfo object is automatically created for an application and is used by default for all printing jobs for that application. The method sharedPrintInfo returns the shared NSPrintInfo. What's not explicitly stated is if you alter that object (e.g., by using setOrie...

How do I get Lucida Grande italic into my application?

Unfortunately, Lucida Grande does not have an italic variant and I need one. My options here seem limited and I am hoping someone has a better one for me. First, I tried, applying a NSAffineTransform by doing the following: NSFont *theFont = [NSFont systemFontOfSize:[NSFont systemFontSizeForControlSize:NSMiniControlSize]]; const CGFl...

xcode 3.2.1 file history via keyboard shortcut

Prior to xcode 3.2.1, you could cycle through the list of files your in history through a keyboard shortcut (Cmd + Option + L/R Arrow key). Now this set of keys will give you the history within the file (ie all of the actions you've performed in this file). Is there a way to navigate with keyboard only between files you have open in yo...

Address Book is returning old values

Hi there, I am having a problem with the AddressBook framework. It all seems to be stemming from ABCopyRecordForUniqueId returning a record with old data. Example: I run up the program below in one terminal window - it shows the current data. I make a change through the address book UI - my program continues to show old data. I run ...

Delete all records in NSManagedObjectContext

Hi, is there a way to delete all the records from an NSManagedObjectContext? I'm using the following code to insert data: NSManagedObjectContext * context = [[NSApp delegate] managedObjectContext]; NSManagedObject * basket = nil; basket = [NSEntityDescription insertNewObjectForEntityForName:@"ShoppingBasket" ...

NSUserDefaults are not being written to disk

Hello, I set some values to NSUserDefaults and if I retrieve them without exiting the app, everything works fine. When I restart the app, the changes disappear in 95% of the time. In 5% of the time everything is being saved ok. I'm facing this problem for the first time. In my other apps I don't usually save NSString in NSUserDefaults....

"Unknown class <MyClass> in Interface Builder file" error at runtime

Even though Interface Builder is aware of a MyClass, I get an error when starting the application. This happens when MyClass is part of a library, and does not happen if I compile the class directly in the application target. ...

Issue with NSWorkspace and NSNotificationCentre's block-based API in Snow Leopard

I've been having some trouble with Snow Leopard's new block-based API for observing notifications from NSWorkspace's NSNotificationCenter. If I register for notifications using the traditional selector-based method, then I am able to observe the desired notification. If I try using the new method that takes a block, then it doesn't work...

NSViewController and multiple subviews from a Nib

I'm having a difficult time wrapping my head around loading views with Interface Builder and NSViewController. My goal is to have a view which meets the following description: Top bar at the top (like a toolbar but not exactly) which spans the entire width of the view, and a second "content view" below. This composite view is owned by m...

NSUndoManager and runModalForWindow:

I have a simple Core Data app which displays a list of entities in the main window. To create or add new entities, I use a second modal window with a separate managed object context so changes can be undone/redone without interfering with the main managed object context. The editing window is launched using runModalForWindow:. If I make...

Help Socket Programming

Hi All In my application I fetching the updated data in every 25 second… but some time my application crashes while fetching the updated data.. to resolve this we are planning to use socket connection for live updates I am tried to find any sample application for socket connection or socket communication in ADC Library platform but fou...

objective-c: Calling a void function from another controller

Hi, i have a void, like -(void) doSomething in a specific controller. i can call it in this controller via [self doSomething], but i don't know how to call this void from another .m file. I want to call it in a -(IBAction) action:(id)sender I've tried using performSelector, but i got a 'unreconiezd selector send' in the log. I've no ...

What are the advantages of use accessors to instances of IB elements?

Usually, when we have to link an interface element to a field of a class, we use the keyword 'IBOutlet' to inform the pre-copiler: @interface MyController : NSObject { IBOutlet NSWindow *theWindow; } and in the implementation we use directly the pointer theWindow to call methods of the class NSWindow! But what are the advantages ...

Controlling OSX windows

I'm trying to control windows of a foreign OSX applications from my application. I'd like to 1. move the windows on the screen 2. resize the windows on the screen 3. change the currently active window of the application 4. get the currently active window. (And I'd like to do this either through ObjC/C/C++ apis). What are the API calls ...

In Cocoa, how do you apply a QuartzComposer patch effect to an NSImage?

I'm not trying to create a series of QC effects, I just want to use the Tracer effect. Do I have to create the QC thing and then apply that, or can I call it directly in Cocoa? ...

Circular #import/@class problem in ObjectiveC

I'm going to use an example to properly illustrate my confusion. I can't quite wrap my head around this. In Cocoa touch, we have UIViewController and its subclass, UINavigationController. Now, UIVC has an ivar of type UINav, and to get around the circular import problem they use @class UINavigationController. I am assuming they then #im...