cocoa

How do I populate an NSPopupButton with an array of strings?

Simple question, but I am struggling a little to understand how Interface Builder interacts with the rest of the program developed in X-Code. My UI has an NSPopupButton that I would like to fill with an array of strings that I provide. I have a controller class that defines the method to execute when the button is clicked. Is that wher...

Drag-and-drop files onto an NSTableView?

I have an NSTableView which I wish to allow users to drag-and-drop video files onto. When they drop the file, it'll get added as a row in the table view. How would I go about doing this? Currently the tableview's takes its data from an Array Controller (which takes its data from a NSMutableArray) I found this documentation, but cannot ...

What's the best way to model _ordered_ lists of items with core data (Mac OS X cocoa)?

What's the best way to model ordered lists of items with core data? ...

How do you test an asynchronous method?

I have an object that fetches XML or JSON over a network. Once this fetching is complete it calls a selector, passing in the returned data. So, for example I'd have something like: -(void)testResponseWas200 { [MyObject get:@"foo.xml" withTarget:self selector:@selector(dataFinishedLoading:)]; } I tried the route of implementing ...

How to dim os x desktop using Cocoa/Core Animation

Is there a way to control the brightness of the OS X desktop programmatically using Cocoa or Core Animation? ...

Is there a way to programmatically extend Apple's Expose

I'm looking for some pointers on how to reproduce the Apple Expose effect in my own app. Is there an API for Expose? If not how can it be replicated from scratch? ...

What should I replace this code with?

I recently got an example of some code from a friend but he told me one line needs to be changed to make it work for me. Here's the code: - (void)tableView:(NSTableView *)aTableView willDisplayCell:(id)aCell forTableColumn: (NSTableColumn *)aTableColumn row:(int)rowIndex { if ([aCell respondsToSelector:@selector(setTextColor:)]) {...

How to take screen shot of an email inside "apple mail" and "entourage" in Mac OS X?

Hi Everyone, I want to write an AppleScript or Cocoa application in Mac OS X which will take screen shot of the email inside AppleMail and Microsoft Entourage. I did this by writing a simple AppleScript code but it takes the screen shot of the page. If email is a long one, I am unable to take screen shot of following pages. Do you hav...

Flipping Quicktime preview & capture

I need to horizontally flip some video I'm previewing and capturing. A-la iChat, I have a webcam and want it to appear as though the user is looking in a mirror. I'm previewing Quicktime video in a QTCaptureView. My capturing is done frame-by-frame (for reasons I won't get into) with something like: imageRep = [NSCIImageRep imageRepWit...

How do you sync a Core-Data application between a Mac and a iPhone?

Just wondering what code I would need to do this? ...

Is it possible to use Cocoa's Bindings to have an editable NSTableView hooked up to an NSMutableArray?

It seems from the bits and pieces I can scrape together that the answer to this one will be "no", so I'll broadly explain what I'm trying to achieve in (the likely) case that I'm trying to hammer in a screw. What I have in my app is a list of valid file extensions to read in, which I'm recursing through a directory for. I want this to b...

How do you make a button link to a website in Cocoa?

How would you make a button in cocoa when clicked open a web page? ...

Objective-C/Cocoa: Proper design for delegates and controllers.

Consider the following common situation: You have some MainView in your Cocoa application, loaded from a NIB, which is controlled by a MainViewController. Your MainView contains some controls, such as a UILabel infoLabel. You also have a delegate MyDelegate class which receives some sort of event. You would like to make sure that whe...

How do you set a title so that every row in a table has the title already typed in when you add a new row?

I am using a Core-Data app, i am looking to set a pre-defined title/word so that every new row that is created already has that title/word typed in. For example the word could be 'New Task' and so when the user adds a new row it would already say 'New Task', how would you do that? ...

How do you make a Text Label display how many rows there are in the table.

I am using Core Data and want a Text Label to display how many rows there are in the table, what code would I need to enter in the class file's to do this? ...

How do I use an NSFormatter subclass with an NSPopUpButton

I want to use an NSFormatter subclass to format the contents of an NSPopUpButton I'm using to display a list of choices. Basically I have an NSArray of MyObjects which is bound to the NSPopUpButton via the Content Values binding and I want to display something in the pop up menu other than what is returned by -description. I don't reall...

What does the property "Nonatomic" mean?

What does "nonatomic" mean in this code? @property(nonatomic, retain) UITextField *theUsersName; What is the difference between atomic and nonatomic? Thanks ...

How to gain access to all open windows on Desktop using Cocoa?

Is there a way to gain control over open windows on OS X desktop and change each window's properties i.e. size or location? ...

Why can't I correctly parse this date string with NSDateFormatter?

I'm trying to parse a string that was generated by an NSDateFormatter using another NSDateFormatter with the same format. Rather than trying to make that previous sentence make sense, here's some code: NSDateFormatter *format = [[NSDateFormatter alloc] init]; [format setDateFormat:@"MMM dd, YYYY HH:mm"]; NSDate *now = [[NSDate alloc] ...

Should I store it in an array, or what?

Hello, I am making an application (iPhone app) which gets information (jokes) from an RSS feed, then populates the tableView. Now, would I take the RSS and store it in an array then populate the tableView, or what? And how do I receive information from an RSS feed? Thanks! ...