cocoa

Cannot find NSExpression while compiling for OSX 10.6

I am building a very simply Core Data + Core Animation application. While compiling for OSX 10.6, 64 bits, Xcode keeps throwing the error: /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/CoreData.framework/Headers/NSFetchRequestExpression.h:16:0 /Developer/SDKs/MacOSX10.6.sdk/System/Library/Frameworks/CoreData.framework/Head...

How to deterministically release Core Foundation object in Garbage Collected environment?

I use Core Foundation methods in garbage-collected environment. According to documentation call to CFRelease simply decrements reference count but does not release the object: The difference between the garbage-collected environment and reference-counted environment is in the timing of the object’s deallocation. In a reference counte...

Programmatically closing an NSWindow when it loses focus

I am making an image picker that will display an n by n grid of selectable button when the picker is popped up. This grid of buttons will be contained within an NSWindow but I would like for the window to be close automatically if the user clicks off the screen. Is there a flag that can be set so that when the window looses focus it wi...

Why does NSURLCredential require both an identity and a certificate list?

In the initWithIdentity:certificates:persistence: method, what is the purpose of the certificates argument? The identity has a certificate associated with it, so which other certificates am I expected to pass to this call? The server is not accepting my certificate, and I suspect it is because I'm calling this wrong. This is my callba...

Stop NSThread while downloading

I have an iPhone app, where I'm displaying a tableview, that's loaded from an RSS feed. When the view is loaded, I call this method to run in a new NSThread: - (void)start:(NSURL*)url { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; NSXMLParser *XMLParser = [[[NSXMLParser alloc] initWithContentsOfURL:url] autorelease]; [...

NSShadow with a NSButton subclass

Here's My Code: - (void)drawRect:(NSRect)dirtyRect { // Drawing code here. // Create the Gradient NSGradient *fillGradient = nil; if (mouseIsDown) fillGradient = [[NSGradient alloc] initWithStartingColor:[NSColor colorWithCalibratedRed:0.868 green:0.873 blue:0.868 alpha:1.000] endingColor:[NSColor colorWithCali...

Auto-persist removing objects from NSArrayController with CoreData

Hi! I have a NSTableView with one column bound to NSArrayController representing a collection of entities from a NSManagedObjectContext. I also have a "remove" button that is connected to NSArrayController's remove action, and it all works fine - table is showing data, when I click 'remove', the entity gets removed from the table etc. ...

How to get the current pic of swf showing in a safari webpage?

Now I have get flash url ,I want to get its current pic , How to do ? Thank you very much! ...

Giving an NSTextView some padding/a margin.

How would I give a NSTextView some padding/a margin to the left? I know how you do it in a NSTextField (by subclassing NSTextFieldCell) but how do you do it in a NSTextView? EDIT: A bit more info: 1. The Text View just has plain text no rich text and no other fancy stuff like a proper text editor (e.g Paragraph insets). 2. Is it possibl...

How we set or get focus to any control - and leave the focus in Cocoa

Hi All How we set or get focus on any control in cocoa. like setfirstresponder We have 2 control A and B, A is firstresponder After action I want to set focus ob B control and also how we get focus on a particular control and how we notify that leave focus..... I need it in validation .... I want to force user to fill a textfield and...

How do you design an interface with a list of varying width elements?

I want the interface to look something like the right side of the Things interface but the items in the list need to be of different widths. Is this achievable with the Interface Builder or do I have to use drawing? I'd like as detailed an explanation as possible. Thanks! Like this : ...

Iphone delegate memory leak problem

Hi Folks, I need your help, i'm stacked on this project. When i run my applicaion into Instruments, →← marked line giving memoryleak. When the fist run everything is ok but second time →← marked line giving memory leak, i didn't understand why ? I tried a lot of things, i used NSAutoReleasePool as well but result same. Can someone ...

Using an NSButtonCell with template image in a NSTableView

In Interface Builder, I have set the dataCell of one of the columns of my NSTableView instance to be NSButtonCell. This works as expected, however, trying to use a ‘template’ image doesn't yield the expected visual result when clicking the button. How I configure the NSButtonCell: Image: NSRevealFreestandingTemplate Scaling: None Beze...

How to update a section of an NSView without redrawing the whole view.

I have a NSView where I draw thousands of NSBezierPaths. I would like to highlight (change fill color) the a selected one on mousemoved event. At the moment I use in mouseMoved function the following command: [self setsetNeedsDisplay:YES]; that force a call to drawRect to redraw every path. I would like to redraw only the selecte...

A method that takes both NSArray and NSMutableArray

I want to create a method that can take an NSMutableArray or an NSArray object. I think I can just use (id) as the parameter type... or convert the NSArray to NSMutableArray before passing. However I'm not really happy with these solutions. In other languages I might pass an IList or some shared object that they both inherit from... ...

Objective-C/Cocoa tutorial for internet capable application?

I've done a bit of iPhone programming (even have 1 published app) but what I'm really interested in doing is learning to create applications for OS X. I'm a 7 year .Net Developer so I have some understanding of how to make desktop applications, though I don't know much about memory management as .Net spoiled me. I was hoping someone coul...

peer - to - peer chat with AsyncSocket class

hi friends, I want to use AsyncSocket class for peer - to - peer chat. I have been able to make a sample chat application where one user can communicate with other user by transmitting messages to server and then from server to other user(s) by using it, but I am finding it some what difficult to manage sockets established in peer - to...

Checkbox State Problem

Hello, I'm new to Cocoa, and working my way through Hillegass's book. I'm having trouble with chapter 20's challenge 2. The challenge is to add checkbox's that toggle if the letter being drawn is italic, bold, or both. -(IBAction)toggleItalic:(id)sender { int state = [italicBox state]; NSLog(@"state %d", state); if (state = 1) { i...

NSOutlineView with Bindings driven by Core Data

I've got an NSOutlineView acting as a source list for my application, and my data model is done with Core Data. I'd like to use bindings (if possible) to glue these things together as follows: I have three main entities in my model, for sake of example let's call them "Stores", "Cars" and "People". My goal is to have the outline view h...

Connecting to a WIFI Network via Cocoa

hi, I'm building an app for my school which enables the pupil to connect to the school's wifi network (wpa2). Into this app the password has to be hard coded because the technician doesn't want it revealed.I've seen some examples such as XNetwork, but I'd rather use Cocoa than AppleScript. Can someone suggest how this can be accomplish...