cocoa

Inserting image into NSViews pageFooter

Hello all, I've been trying to insert an image into the page footer of a custom NSView, so that when I print it, it will display text and an image in the footer. Here is the code that I am using: - (NSAttributedString *)pageFooter { NSString *imgName = @"Logo.tif"; ...

NSURLConnection - Is it possible to wait/block on a request?

Hi All, I need to wait for a response from a SOAP webservice, I am calling via a NSURLConnection as I need to manipulate the data being returned and then return it from my class to the calling class. I cant figure out how I can possibly do it. Here is my code at the moment: #import <Foundation/Foundation.h> @interface UsersBLL : NSO...

How can I prevent myself from accidentally using an NSNumber's pointer when I want its intValue?

One feature of Java that I really like is autoboxing, in which the compiler automatically converts between primitives and their wrapper classes. I'm writing a Core Data application in Objective-C/Cocoa, and I'm finding it frustrating to deal with my integer attributes programmatically. Here's why: //img is a managed object that I have ...

Can't load Quartz animation in screen saver: "You cannot use the XXX screensaver on this computer"

I've written a simple screensaver that loads a Quartz animation using a QCView. But when I install it on Snow Leopard it appears in the Screen Saver preview with a message saying "You cannot use XXX screensaver on this computer...". If I comment out the loadCompositionFromFile line (but leave the Quartz framework linked) it's fine. I ...

Parsing and Writing XML in MAC 10.3.9 Cocoa?

Hi, What is the Best way i can do Parsing or Writing into XML using cocoa for mac10.3.9.? Im mentioning the version of OS specifically because, i read in the documentation like, Mac 10.3.9 sdk does not support NSXML class.? I Found an OpenSource libaray (libxml), is it the only library i can use???? Please give me some suggestion regar...

override description or stringValue in cocoa?

I want to have an descriptive string for an object in Cocoa. I'm thinking about overriding either the description method or the stringValue method. Which is preferable and why? The only guideline I could find was in here stating You are discouraged from overriding description. Is this indeed what you would suggest? Any other prefer...

- (void)scrollWheel:(NSEvent)theEvent does not work

Hello, I wrote an app in cocoa with a window document with a PDFView inside. I am trying to intercept scrollWheel: events in the PDFView but for some reason that method is never passed to the PDFView. Instead the view scrolls down or up depending on your perspective. scrollWheel: is part of the responder chain so I expect the method to...

Suppressing "'…' is deprecated" when using respondsToSelector

I'm supporting 10.4+ by picking the most-current API at runtime: if ([fileManager respondsToSelector:@selector(removeItemAtPath:error:)]) [fileManager removeItemAtPath:downloadDir error:NULL]; else [fileManager removeFileAtPath:downloadDir handler:nil]; In this case, 10.5 and up will use removeItemAtPath:error: and 10.4 will u...

How can I multiply an image against the alpha of another image in Cocoa?

Having loaded two different images I want to do the following operation and obtain image3. image1.red * image2.alpha = image3.red image1.green * image2.alpha = image3.green image1.blue * image2.alpha = image3.blue I wrote the code in the link below for Android and was basically looking for the same functionality in Objective-C/Cocoa. ...

Mutex in JNI using Foundation NSLock

I have some objective-c code that uses an NSLock to implement a sort of transaction. The object is locked on a "begin transaction", several other calls are made with the lock in place, and then it's released with a "commit". I'm writing a JNI glue layer to access this code from Java, but the lock is behaving differently in JNI vs pure ...

How to programmatically make cocoa application active

Hi all - I've got a background process that makes a transparent window appear when a hotkey is pressed: [window makeKeyAndOrderFront:nil]; [[content animator] setAlphaValue:1.0]; // alpha was 0.0 ... the window shows up fine & in front of the other windows (as I want it to), however until I manually click the window whatever applicati...

click on the Menu bar item to show a window

Here's my code: if ([window isVisible]) { [NSApp activateIgnoringOtherApps:YES]; [window orderOut:nil]; return; } [NSApp activateIgnoringOtherApps:YES]; [window makeKeyAndOrderFront:nil]; return; but if the user clicks/changes the current window and then clicks on menu bar it will close the window. How do I stop that? ...

USB on Mac (how to use digital to analog converter on mac with cocoa)

Hi I have to play an audio file on digital to analog converter (Silverstone digital to analog converter Model number DB01S) on Mac ox x 10.6 with cocoa. I used USBSimpleExample from apple but i am always getting this error "dealWithInterface: unable to open interface. ret = e00002c5" Any help would be appreciated! Thanks ...

Sliding from One View to Another.

How would I change from one view to another with a slide transition? Thanks. ...

How to use NSDateFormatter with NSPopUpButton

I have an NSPopUpButton's content bound to an Array Controller of "Meeting" entities and it's content value bound to the same array controller, but to the "date" model key path. Everything works fine. But I'd like to format the way the date is displayed with an NSDateFormatter and I can't get it to work. Any hints? Is it even possible? ...

Creating a parenet less modal dialog or MessageBox or alert Sheets in cocoa?

Hi.... Issue1: I want to show an alert window or message box before the Main Window of the Application is launched. When im using the NSRunAlertPanel() it is not showing the alert window.It is directly launching the Application's Main Window. Issue2: I want to create an Modal (login dialog) and message boxes in an thread spanned from ...

iPhone Core Data: Property Persistance Durring Undo

I've got a data model built in core data for the iPhone. I also have an NSUndoManager working for that model. The problem is that I have certain properties on an entity that i don't want affected back during an undo and other properties that I do want rolled back. Is this possible without drastically changing things. If so what is the be...

Cocoa: What's the difference between importing in the header and importing in the main file?

I've no idea why, but on occasion I've managed to fix some compile errors, most notably error expected specifier-qualifier-list before 'someClass' by moving #import "someClass.h" from the .h file into the .m file. This has also worked with a couple of other problems i've encountered that have been (mysteriously from my point of view)...

Chaining Core Animation animations

Which is the most elegant and modular way to chain animation in a Core Animation context? I mean to do animations that starts just when other finished (for example, changing position and then opacity).. normal approach is to directly change properties: layer.position = new_point; layer.opacity = 0.0f; but this will do them at the sa...

Bindings - master detail array controllers

I really hope someone can help on this because I'm learning cocoa and have hit a road block. I am trying to model a simple poker tournament. For now, my entities are simply a Tournament (with a number) and a Player (with a Name). A Tournament has an array of Players. I can bind two independent table views to display the tournaments a...