cocoa

How to set up a simple table view in Cocoa

Hello, I was wondering if anyone could give me an example or point me to some example code of how to use an NSTableView. I know how to use it in core data but I would like to do this just using plain cocoa code. All I need is a simple add and remove button. Also is it possible to have cocoa write the data to a text file or plist? Thank...

Multi-column sorting with an NSTableView bound to an NSArrayController

Hi there. I have an NSTableView that's bound to an NSArrayController. Everything gets loaded into the table correctly, and I have sort keys and selectors set for the various columns (this also works). What I'm trying to do is sort multiple columns when the user clicks one column header, but I can't find any way to do this. I could br...

NSCalendar: Problem getting weeks in a month...

I am creating a calendar control of sorts... One thing I need to know is how many weeks are there in a Month... So NSCalendar rangeOfUnit:inUnit:forDate Seems to be exactly what I need... Except I am noticing something that seems off and I can't quite figure out why this is happening... The following code... NSCalendar *calendar = [...

Core Data Null Relationship

I have a to-one relationship in my data model with Core Data. I'm trying to set the value of the relationship but Core Data keeps thinking that it's nil. The "creatorUser" relationship is not optional, so when I go to save my managed object context, Core Data gives errors because it thinks the "creatorUser" is nil. Any help would be gr...

keyDown works but i get beeps

I just got my keydown method to work. But i get system beep everytime i press key. i have no idea whats wrong. Googled for hours and all people say is that if you have your keyDown method you should also implement the acceptsFirstResponder. did that to and it still doesn't work. #import <Cocoa/Cocoa.h> #import "PaddleView.h" #import "Ba...

Extracting a URL from within a string

My app receives numerous text strings which may or may not contain a URL anywhere within the string. What would be the best method to extract a URL from within a string? Thank you. ...

NSTextField and hidden property

Hi, I have an NSTextField that I hide when the user presses a button. I hide the text field using [textField setHidden:YES]; The problem is that is the user is typing in the text field (i.e. the text field is first responder) and the user presses the return key (which is the key equivalent for the button that hides the text field) the u...

Zooming in an NSView

Hi, I have an NSView in which the user can draw circles. These circles are stored as an array of NSBezierPaths, and in drawRect:, I loop through the array and call -stroke on each of the paths. How do I add a button to zoom in and out the NSView? Just change the bounds of the view? Thanks. ...

Embed font in a mac bundle

I have a program I am writing. I want to use a fancy font. Can I just embed my font into my bundle and use it from there. My code... NSMutableAttributedString *recOf; recOf = [[NSMutableAttributedString alloc] initWithString:@"In Recognition of"]; length = [recOf length]; [recOf addAttribute:NSFontAttributeName value:[NSFont fontWi...

Import csv data (SDK iphone)

I am new to cocoa. I have been working on these stuff for a few days. For the following code, i can read all the data in the string, and successfully get the data for plot. NSMutableArray *contentArray = [NSMutableArray array]; NSString *filePath = @"995,995,995,995,995,995,995,995,1000,997,995,994,992,993,992,989,988,987,990,993,989...

Is it possible to do some interop with iWork?

I know it is possible with the .NET framework of Microsoft to do some interoperability with Microsoft Office. Is there something that exist that resembles to it for iWork and the Cocoa framework? Edit: Here are more details. I would like to create an application that has a GUI and that can generate Pages/Keynote/Numbers documents. ...

Tracing directory contents.

Hi, How can one trace the content of a directory? The directory here refers to non home and non current directory. Explicitly, I have three directories 10.5.8 - current directory Development Backup So, how can I undergo file operation like create, accessing or deleting on Development or Backup directory other than my current d...

Address book APi

hi how an i get phone no of a given record using xcode i am able to get first name and last name using ABRecordRef *person_record = CFArrayGetValueAtIndex(people,i); NSString *first_name = ABRecordCopyValue(person_record,kABPersonFirstNameProperty); NSString *last_name = ABRecordCopyValue(person_record,kABPersonLastNameProp...

Recording Audio on iPhone and Sending Over Network with NSOutputStream

I am writing an iPhone application that needs to record audio from the built-in microphone and then send that audio data to a server for processing. The application uses a socket connection to connect to the server and Audio Queue Services to do the recording. What I am unsure of is when to actually send the data. Audio Queue Services f...

Optional Navigation Controller

I have an application containing a variety of view controllers linked together in different ways (Welcome > Browse > Preview OR Browse > Preview OR Settings > Splash). The first view controller is presented modally using a navigation controller from a main controller, then the next set of view controllers are added using pop and push. ...

Memory management / ownership question?

Do I have this right ... // Reactor.h @property(nonatomic, retain) NSMutableArray *reactorCore; // Reactor.m [self setReactorCore:[NSKeyedUnarchiver unarchiveObjectWithFile:[self dataFilePath]]]; ... -(void)dealloc { [reactorCore release]; [super dealloc]; } I am pretty sure I am doing this right (but just wanted to check). ...

When is 'drawRect' called?

I have some custom drawing code in drawRect which also performs some calculation of sizes. When is the earliest I can be sure that this code has been loaded, e.g. if I want to modify it's containers size accordingly? ...

NSPredicate to exclude NSManagedObjects that haven't been saved in an NSFetchedResultsController

Building on this question, I've managed to use undo groups and a single managed object context to handle adding a Cocktail that can reference existing Ingredients and/or Brands. Now I'm stuck with a UI nit -- in the fetched results controller (sorted by cocktail.name) you can briefly see an empty row for the to-be-added Cocktail. Marcus...

Faking a dynamic schema in Core Data?

From reading the Apple Docs on Core Data, I've learned that you should not use Core Data when you need a dynamic schema. If I wanted to provide the user the ability to create their own properties, in a core data model would it work if I created some "dummy" attributes like "custom decimal 1", "custom decimal 2", "custom text 1", "custom...

Given year, month and day, all in int, how would I generate an NSDate

I think the solution is really simple, I just haven't come across it online. Suppose I am given int year, int month, int day, int hour, int min, int sec.. how do I generate NSDate out of it? I know we can use [NSDate initWithString:] but I think it gets complicated if month/day/hour/min/sec are one digit numbers. ...