cocoa

UIButton.layer.cornerRadius doesn't exist?

Hi, I'm implementing a custom UIButton with minimal functionality. The .h file: #import <Foundation/Foundation.h> @interface CustomButton : UIButton { } @end I'm encountering a compilation error at line (A) in the .m file: - (id)initWithCoder:(NSCoder *)coder { if(self = [super initWithCoder:coder]) { CALayer *layer = [sel...

Custom Mac Installer Overwrite /Library/Application Support File

My installer places a file into /Library/Application Support/AppName. As a final step of the install process in a custom installer plugin (Objective-C code) I check for a more recent version of that file. If it exists, I download it and then attempt to overwrite the one created by the installer. The issue is that I apparently don't have ...

Display Opened Document's Path at Startup in NSPathControl object ...

My project is a doc based application. I'd like to use an NSPathControl object to display the path of the opened document at startup. I'd insert the code here: (void)windowControllerDidLoadNib:(NSWindowController *)windowController Can someone point me to an example? thx. ...

How do you change a drag-and-dropped image mid-drag?

So I want to drag an object from one source to multiple potential destinations. When the object is over each destination, I want it to 'morph' into a different image. Is there a straightforward way to do this from the NSDragSource perspective? ...

Calling an NSAlert from didEndSelector of another NSAlert

I need to bring up an NSAlert based on the response from another NSAlert. However, when I try to call it from the didEndSelector of the first one, all kinds of nasty things happen (like my document window disappearing and warnings about ordering problems printing to console). Any thoughts? ...

IBAction gets stuck in Loop.

Ok, I have an IBAction that syncs with iCal and is also triggered by KVO of the 'name' property in my CD Model, so that when the property changes the Action is triggered. What happens is that once the IBAction reaches the end it skips to the KVO declaration which then triggers the Action again and again and again, this is where the loop ...

MacRuby, sheet error

I'm running with MacRuby 0.5 and I have a method: attr_accessor :bookmarkSheet, :mainWindow def createBookmark(sender) NSApp.beginSheet(bookmarkSheet, modalForWindow:mainWindow, modalDelegate:self, didEndSelector:nil, contextInfo:nil) end which is supposed to open up a sheet panel on the main window. However, wh...

Fade in/Fade out for MAAttachedWindow

I'm using Matt Gemmell's MAAttachedWindow (http://mattgemmell.com/source) with an NSStatusItem to display a custom view in the menu bar. I'm confused as to how to get it to fade in and fade out. Normally I'd do something like this: [window makeKeyAndOrderFront:self]; [[window animator] setAlphaValue:1.0]; and to fade out: [[window an...

Maintain Undo In Modified, Bound, NSAttributedString

I've got an attributed string bound to a NSTextView. I'm using a method that is called (using KVO) every time the string is edited to add background color attributes to string based on a regEx match. I do this by creating a new mutable attributed string with -initWithAttributedString: then -beginEditing, -addAttribute:, -endEditing. Once...

Standard (32/64-bit Universal), WebKit, Flash Plugin and Leopard

I have an Xcode project which builds a Cocoa desktop Browser application. My Browser links to the standard WebKit.framework on the system (it does not embed its own WebKit.framework). The "Base SDK" for my Xcode project is set to "Mac OS X 10.5". The "Valid Architectures" for my Xcode project is set to "i386 ppc ppc64 ppc7400 ppc970 ...

Force a Mac OS X 32/64-bit universal binary to run 32-bit on Leopard only?

I want to ship a single 32/64-bit universal binary of my desktop Mac OS X Cocoa app. I don't want to ship two versions. I want it to run as a 64-bit process on Snow Leopard. However, if the app is launched on Leopard, I want to always force it to run as a 32-bit process. NOTE: I know that in the Finder 'Get Info' window you can click ...

Does stringWithContentsOfURL use the system proxy settings?

I am using the following code to fetch the contents of a web page but it needs to follow all the network rules etc as defined in the user's system prefs NSURL *url = [NSURL URLWithString:@"http://thetalkingcloud.com/static/ping_desktop_app.php?v=1.0"]; NSError *theNetworkError; NSString *content = [NSString stringWithContentsOfURL:ur...

Cocoa/Objective-c 'system();' acting weird

I'm trying to run an applescript inside my Cocoa app using the system(); function - the string I'm passing to the function works in terminal and the applescript itself is fine, I think it has something to do with NSString - can anyone help? //add to login items NSLog(@"add to login"); NSString *pathOfApp = [[NSBundle mainBundle] b...

Dispatch queues: How to tell if they're running and how to stop them.

I'm just playing around with GCD and I've written a toy CoinFlipper app. Here's the method that flips the coins: - (void)flipCoins:(NSUInteger)nFlips{ // Create the queues for work dispatch_queue_t mainQueue = dispatch_get_main_queue(); dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, NUL...

Embedding a predefined SQLITE doc in Core Data Application

Thanks for the help. I have a woking Core Data doc based app. that solely supports SQLITE docs. I would like to distribute the application with a previously created database document with predefined data embedded in the application bundle. How do I instruct the application to run the embedded file at runtime? thanks. -paul. ...

How do I manage the drawing of custom data (not photos) in an NSView that has an area dynamically larger than what is viewable?

UPDATE: Relative to the questions and answers below, it seems I have a misunderstanding of the NSView class in relation to the custom classes I'm trying to draw and the wrapping NSScrollView. In the end, what I'm trying to figure out is how do I manage the dynamic drawing of custom data (not photos) in an NSView that has an area larger t...

Creating NSMatrix of NSImageCells

I need to create an NSMatrix with NSImageCells bound to an array controller. So the content of the NSMatrix is bound to an NSArray (so there are as many NSImageCells in the matrix as there are objects in the array), then the image path of the NSImageCells are bound to a key called "iconPath" in the Array Controller. And then when an ima...

Get size of image without loading in to memory

I have several .png images (ETA: but the format could also be JPEG or something else) that I am going to display in UITableViewCells. Right now, in order to get the row heights, I load in the images, get their size properties, and use that to figure out how high to make the rows (calculating any necessary changes along the way, since mo...

Auto-hide the OS X menu bar system-wide

I wish to write a utility to auto-hide the menu bar, much like the dock. This would replicate the a OS X 10.4-only application "Menufela", but for Snow Leopard. [[NSApplication sharedApplication] setPresentationOptions: NSApplicationPresentationAutoHideMenuBar | NSApplicationPresentationAutoHideDock]...

Generic Xcode usage questions

I have 3 general questions related to the usage of xCode. Any help would be greatly appreciated please: Whenever I open documentation, the left content/index column is always small and I have to drag it wider. Is there a way to permanently set its size? Is there a way to perform a wildcard search and replace e.g. I have 3 lines: var1Le...