cocoa

Index of item within NSCollectionView

In my collection view I need to generate an index for each item. As Items get reordered I need this index to update with its new position. The data are Core Data entities in a managed NSArrayController. The closest I have come to a possible solution is implementing this method on the entity class and then using representedObject.dynamic...

NSDateFormatter problems between versions 10.4 and 10.5

Hey there everyone! I'm creating an app that needs to run on 10.4 and above. Having a date string that is formatted properly is crucial. When I run my program in 10.5 debug everything is good; I get a date which is exactly how I want it: Jul 13, 2010 16 the 16 being the hour without the minutes, which I specifically need. Then when ...

Can you force unreferenced code to be linked in from a static library?

Here's the scenario - I have created a custom NSView subclass, and the implementation is in a static library. The class is never referenced from the final executable, only from the Interface Builder XML file. Since it's not referenced, it doesn't get included at link time, and as a result the class can't be found at runtime. Is there an...

Programmatically change Mac display brightness

How to change Mac display brightness from cocoa application? ...

Parse string in objective c object

How can I parse this into an objective-c object most efficiently? "2010-07-13T11:22:33-07:00" This is what I tried NSDateFormatter *format = [[NSDateFormatter alloc] init]; [format setDateFormat:@"yyyy-MMM-ddTHH:mm:ssZ"]; ...

Rendering multiple document formats with Cocoa's CoreGraphics

CoreGraphics gives the possibility to render PDF documents, this is great. But it seems like it could support other types too like Word documents, HTML, RTF and others. A quick look in the doc2pdf.py example on the Mac OS X Developer DVD makes me think so : pageRect = CGRectMake(0, 0, 612, 792) c = CGPDFContextCreateWithFilename(ou...

MPMusicPlayerController stops working after iTunes sync

I know there's a similar question MPMusicPlayerController stops sending notifications, but the answer to that question doesn't solve this problem. I'm using iOS 4, and this happens on both multitasking-enabled devices and non-multitasking devices. I've tested on iPhone 4, iPhone 3GS, iPod touch 2G, and iPod touch 1G. I have a project ...

Bind Top 5 Values of a To-Many Core Data Relationship to Text Fields

Hi, I am making an application that represents a cell phone bill using Core Data. I have three entities: Bill, Line, and Calls. Bills can have many lines, and lines can have many calls. All of this is set up with relationships. Right now, I have a table view that displays all of the bills. When you double click on a bill, a sheet comes ...

What happens when I hit quit in a cocoa program?

I have a Cocoa/Objective-C program, I set it up the way it wants, with a menu bar, etc, and the quit menu item comes pre-linked to FirstResponders Terminate method. Fine. But what happens in that method? More importantly, how do I get things to happen on quit? I have an AppController object that is the delegate of the mainmenu, and is ...

NSXMLParser for xml! why is it so hard to use? is there an easy way?

For the last few hours I have tired to get my head around using NSXMLParser. I understand parts of how it works. WHY Oh WHY! is this so hard? Is there an easy way to do it, like just name the tag and get the contents? Oh how I miss XmlDocument object from .Net. Thanks a million. ...

Focus on next valid key view on iPhone

Is there an iPhone equivalent for the NSResponder methods -selectNextKeyView or -nextValidKeyView from Mac OS X? I know about the -becomeFirstResponder method, but finding out which view to call that on is not very pretty when view hierarchies get more complicated. There must be some kind of way to find this out as when I press tab when...

Cocoa Touch - Changing the text of a button and a label

Well.. I forgot how to change the text of a button and label in cocoa touch. Please remind me.. IBOutlet id questionLabel; IBOutlet id answerButtonOne; IBOutlet id answerButtonTwo; IBOutlet id answerButtonThree; IBOutlet id answerButtonFour; ...

Ruby on Rails and Cocoa - POST puts values into DB as NULL

Hello, I am trying to send a POST request to my Ruby on Rails local server. Unfortunately, at first it wouldn't let me POST because of protect_from_forgery, so I ended up setting it to false in development and production. Basically, my issue is that I'll send the POST request from my Cocoa app with all of the wanted params, and the Ruby...

How to handle NSURLRequest HTTP error 303?

When I run my NSURLRequest in Cocoa, I get a 303 HTTP error, which is a redirect. How can I pull the proper URL to redirect to? Is it in the error variable, or somewhere else? ...

NSView Not updating?

Hello, Im working on a drag n' drop view and found some handlers for drag and drop actions on the web. I want to make it so it turns blue when the user drags a file over the drag and drop area and gray again when they exit the drag and drop area. The issues is its not updating when you drag your mouse over it or exit it. Heres some of t...

Any possibility to get a notification if another application receives a scroll event?

Hi, I'm developing an application in Cocoa which allows users to draw on any given window in OS X. The drawings move along with the corresponding window when dragged on screen. To complete this tie between drawings and the windows (and their contents) beneath, I'd like to catch scrolling events from the window in order to react on the p...

Cocoa CoreData and non-Document-Based Application

Hi all, i have a Problem wich drives me crazy... I want to "write" a Cocoa CoreData Application, write is not the exact term, because the Application should be created with Bindings. It was no Problem to create a Document-Based Application, it works fine. But i want a Non-Document-Based Application, so I thought "Do the same like at th...

How to add custom UTI in xcode app for exported plist xml format

Hi All, I am working on one cocoa application and exporting some data stored in NSArray to plist(XML) format. I want to give custom extension and icon to that exported plist.This custom extension plist file will be imported and exported by my application only. I tried few links but unable to make that working. I am using xcode 3.1.4 an...

How to check the last char of an NSString

Hi, everyone, I want to ask a question about the NSString * in objective C. Can I check the last char of a NSString * object? Example: NSString* data = @"abcde,"; if(data is end with ',') // I don't know this part // do sth Thank you very much. ...

How to badge file and folder using cocoa

I want to badge file and folder with some color(image), any idea how it can be achieved I tried with icon service, it work for files but it is not working with folders. I saw this behavior working Dropbox(https://www.dropbox.com/) (10.4, 10.5 and 10.6)- any idea how can this be done? The following was very close one for me, but it is n...