cocoa

Colored iCal style checkboxes using Cocoa

Is there a way to get colored checkboxes like in iCal without using custom drawing? I have looked through the documentation but can only find how to change the background and text color. ...

[CA_COLOR_OPAQUE] things that make a layer non-opaque. scaled CAGradientLayer?

i spent some time with the environment variable CA_COLOR_OPAQUE = 1 and have my findings to share. things that make a CALayer non-opaque (slow, more memory, ...): * contents with alpha (like an NSImage with an icon) * NSImage/CGImage from a pdf as contents (even when the pdf does not contain any alpha and opaque=YES) * b...

Default window shadow dimensions for Snow Leopard?

I would like to emulate the default shadow applied to NSWindows with a CALayer shadow. I can't quite figure out the exact values for the the following properties though: theLayer.shadowOffset = ?; theLayer.shadowRadius = ?; theLayer.shadowOpacity = ?; I assume that the shadowColor is black (the default). Does anyone have an idea wha...

NSOutlineview - strange behavior after reloading data

I have a NSOutlineView which loads data from a data source. The table is displayed in a panel. The items shown in the table are items which belong to an object (the relation is one-to many between the object and the items). I have a list of objects in a combo box (in fact a NSPopupButton), and when I select another object in the combo ...

Retrieving Absolute URL from File on Mounted Volume in Cocoa

Is there any way of retrieving an absolute URL for a file on a mounted volume in Cocoa? For example, say afp://server/Documents is mounted at /Volumes/Documents. How can I get full URL to a file on the mounted volume in the form of afp://server/Documents/path/to/file? I've tried using statfs but the value of f_mntfromname doesn't con...

Core Data fetch request with array

I am trying to set a fetch request with a predicate to obtain records in the store whose identifiers attribute match an array of identifiers specified in the predicate e.g. NSString *predicateString = [NSString stringWithFormat:@"identifier IN %@", employeeIDsArray]; The employeeIDsArray contains a number of NSNumber objects that matc...

Using Reachability for Internet *or* local WiFi?

I've searched SO for the answer to this question, and it's not really addressed, at least not to a point where I can make it work. I was originally only checking for Internet reachability, using: self.wwanReach = [Reachability reachabilityWithHostName:@"www.apple.com"]; [wwanReach startNotifer]; I now need to support a local WiFi con...

Simple CalendarStore query puts application into infinite loop!?

Hi, I've been looking at adding iCal support to my new application and everything seemed just fine and worked on my Mac OS X 10.6 Snow Leopard development machine without a hitch. Now it looks like depending on what is in your calendar the very simple query below: - (NSArray*) fetchCalendarEventsForNext50Minutes { NSLog(@"fetchCalend...

How to close a window (unload a NIB)?

I have a custom NSWindowController subclass that loads a NIB file during initialization like this: self = [super initWithNibNamed:@"myNib"]; if (self != nil) { [self window]; } The nib contains some custom views and some other controls. The NSWindowController is the file's owner and at least one of the views even binds to it. Sim...

Detecting/Repairing NSConnection failure

I would like to use NSConnection/NSDistributedObject for interprocess communication. I would like the client to be able to handle the case where the server is only occasionally reachable. How can I determine if sending a message to the NSConnection will fail or has failed? Currently if my server (the process that has vended the remote o...

Keep object oriented towards a point while it's animated along a path

I'm trying to animate an object along a path...while it's moving it should continue to "point" towards another object (or CGPoint). What should I be looking for in the framework (Cocoa-Touch) to accomplish this? Maybe something in CAShapeLayer? Though I think that's more for animating the path itself... It's not jumping out at me... ...

Threading questions

If I spawn a secondary thread and the threaded method calls other methods, are those methods run in the secondary thread or the main thread? Is there a way to determine on which thread a specified piece of code is being run? ...

Core Data Errors vs Exceptions Part 3

My question is similar to this one. Background I'm creating a large number of objects in a core data store using NSOperations to speed things up. I've followed all the Core Data multithreading rules - I've got a single persistent store coordinator and a managed object context per thread that on save is merging back to the main managed...

Parsing XHTML with inline tags

Hi, I'm trying to parse an XHTML document using TBXML on the iPhone (although I would be happy to use either libxml2 or NSXMLParser if it would be easier). I need to extract the content of the body as a series of paragraphs and maintain the inline tags, for example: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/T...

Slider value available between different cocoa classes

I am playing around with an iPhone app, and need to accomplish something that I am sure is very basic: I have a slider that is implemented in a Controller.m class. However, I need its value must be available in a different class, MainView.m class where I have defined an equation that depends on the value of the slider. How can I do i...

Does each CALayer have it's own CGContextRef?

I'm trying to figure out the best way to do hit detection on a CALayer containing a non-rectangular path. I am aware of the CGContextPathContainsPoint function but im not sure how to get a reference to the appropriate CGContextRef when I need to do hit detection (like mouse down). Is it safe to retain a reference to the CGContextRef that...

How to resize NSTextView according to its content?

Hi all, I am trying to set an attributed string within NSTextView. I want to increase its height based on its content, initially it is set to some default value. So I tried this method: I set content in NSTextView. When we set some content in NSTextView its size automatically increases. So I increased height of its super view that is ...

Bind enabled of NSButton to selection in NSTextView

I have a button that does something to the selected text in NSTextView. If nothing is selected then nothing happens when the button is pressed... so can the enabled property of a button be bound to whether or not some text is selected? ...

Released object crashes app

I am using objective-C++ (+Boost) for iPhone development. I am in a rather tight loop and need to allocate and release a certain object. The code is something like this. for (int i=0;i<100;i++) { opt = [[FObj alloc] init]; //do stuff with opt [opt release]; } The FObj object is something like @interface FObj MyCPPObj ...

Which object called another object's method in Obj-C

Hi, I am looking to write a plugin controller in Cocoa that loads bundles, and exposes a specific set of methods for the plugins to call. My question is this: is it possible to know (any) info about the object that called a method in the controller. When an instantiated plugin calls a method in my plugin controller, I would like to kno...