cocoa

Getting rid of the focus rect on an NSCell. Only shows up when right clicking.

I have an NSCell subclass that I do all kinds of custom drawing in. The only time things seem to be entirely out of my control is when right clicking a cell to show the associated context menu. While showing it's context menu, the table (or cell - not sure which exactly is doing this) draws a focus rect. I would like to get rid of this, ...

Binding NSSlider to control the zoom of an IKImageBrowserView

Hi, It turns out that in order to do this one has to bind the NSSlider's Value to IKImageBrowserView's zoomValue. My question is why it only works in this way? It seems more natural (to me) to bind IKImageBrowserView's zoomValue to NSSlider.intValue Thanks! ...

Asyncsocket VS NSstream

Hi, I have to create an sample code that connect to a socket server, and then be able to send multiple NSString through the socket. In the begging i start using NSStream objects, but i had a problem to reuse the socket (maybe i'll post another question if the nsstream solution is the best), and when i google socket for iPhone programmi...

iPhone BitmapImageRep

I have a buffer which has JPEG image data. I need to display this image in UIImageView. I need to convert this image buffer into an object of UIImage and use it as follows NSData *data = [NSData dataWithContentsOfFile:appFile]; UIImage *theImage = [[UIImage alloc] initWithData:data]; I get the image displayed but with a low resolution...

Why do the variables behave so strange?

I thought an variable in objective-c is just a reference to an object somewhere in memory. So for my understanding, the result must have been "one", because at the end i assign the object's memory address of str1 to str2, and previously I had assignend the memory adress of str2 to test. NSString *str1 = [NSString stringWithCString:"one"...

Mixing C functions in an Objective-C class

I am writing an Objective-C class but is uses an API written in C. This is mostly fine as mixing C calls with Objective-C calls causes few problems. However one of the API call requires a call back method (example): success = CFHostSetClient(host, MyCFHostClientCallBack, &context); Where MyCFHostClientCallBack is a C function defined...

"Refreshing" an XML feed on iPhone/Mac OSX

Hi all, I'm curious for those of you who are building iPhone apps based on REST/SOAP/XML-RPC or simply pulling down a dynamic XML feed, what does it mean exactly to you when a user says 'refresh' the feed? The straight forward way is to populate some collection, say an NSMutableArray, with whatever you bring down from the feed. If a wi...

Cocoa development: malloc: free_garbage: garbage ptr = 0x18a15e0, has non-zero refcount = 1 error

I'm developing a Cocoa app, and every so often when running my app in Xcode I get the following sorts of messages in the debugging console: <My app name>(952,0xb0103000) malloc: free_garbage: garbage ptr = 0x107b2f0, has non-zero refcount = 1 I turned on MallocStackLogging and NSZombieEnabled and did a malloc_history on a couple of...

Is it valid to say that a Getter is the owner of the instance variable? Or who owns it?

Actually I would say: yes, the Getter is the owner. So anyone who calls the Getter is not responsible for freeing the memory. Or more precisely, the object itself is the owner, but the Getter acts as a delivery mechanism of the instance variable to others. Is that right, or did I get that wrong? ...

Load .wav file for OpenAL in Cocoa

I need to load sound files to a Cocoa-based OpenAL app. Progress: The OpenAL utility function alutLoadWAVFile has been deprecated; the alut header is no longer included in Mac OS X SDKs. According to the TechNotes, the actual code is still there for binary compatibility. However, if I attempt to add a declaration for the function, t...

iPhone UITextField in Landscape mode

How do you get the keyboard (for editing a UITextField) to come up in the correct orientation if you are in Landscape mode? I'm doing a game in openGL in landscape mode. I add a UITextField when it's time for the user to enter their name for a high score. I can rotate the UITextField (with a CGAffineTransformMakeRotation thanks) but ...

Naming conventions for BOOL Obj-C 2 properties?

I have a readonly BOOL property. What is dominant naming pattern here? Background: for plain old method declarations, the accepted pattern - (BOOL)isEditable; - (void)setEditable:(BOOL)flag; In a @property world, that would typically be expressed as @property(getter=isEditable) BOOL editable; However, there are examples to the con...

Memory Leak Issue with NSMutableArray

I wrote this function in a Helper class for reading a table from my database, and returning it to my controller. On my viewdidload, i cache this result into a class variable (retain property set) and trying to use that inside a picker view control's delegate method. (titleForRow) Somehow, I get a EXC_BAD_ACCESS when I try to access the...

Save documents as folders, like Pages, Numbers, etc...

What's the right way to go about saving data like Pages, Numbers and other OSX applications do? That is, it looks like a file to the user, but is in fact a directory (a bundle?) containing a variety of stuff. I have some fairly complex data that I'd like to store in the same way; in particular, some sensor data that needs to be associate...

Link to a constants file in Cocoa / Xcode

In reference to this related question on stackoverflow: If you create a constants file, how do you "link" to it in your target, so you don't have to #import "Constants.h" in every file you use constants? ...

Getting a CGImageRef from IKImageBrowserView

I feed the image browser view with image filenames and it manages loading them. Is there a way to retrieve the CGImageRef of those images from the browser after it loads them? I'd like to do some Core Animation with them when the user clicks on an image. ...

How to Generate a DSA signature?

I'm using Sparkle in my Application to do updates but in the documentation it says to generate a DSA Signature and provides a tool to do is (the tool is coded in ruby) but i don't know how to use it. Can someone help? This is where the documentation is (Step 3): http://sparkle.andymatuschak.org/documentation/pmwiki.php/Documentation/Bas...

Creating a quick look style zooming effect

I would like to create an effect than an image zooms up from a thumbnail size to full screen. I am not sure what's the right steps to achieve this. Should I create a transparent full screen window and animate a layer on top of it? ...

Using QTKit to capture directly to a QTMovie

Is there any way to use QTKit to capture directly to a QTMovie, without having to go to disk first? I'm trying to glue a couple of pieces of video that I've captured together (with appendSelectionFromMovie:), and waiting for the video to be written to disk and then reading them back is inefficient and dumb. ...

From PHP to Objective-C

Being a pretty experienced PHP developer, and having a fair knowledge of C (Wrote a distributed computing experiment with 16 of my Dad's NEC microcontrollers), I'd like to make the move to Objective-C and Cocoa, eventually aiming to integrate the Mac / iPhone apps with some of my PHP projects. Going through the "Cocoa Programming For Ma...