objective-c

objective-c memory management: caching view elements

Hi, I'm writing an application which is quite graphically heavy and therefore I'm trying to implement a caching mechanism within my view controller that creates a view once, and retains it for future use, similar to the following: - (UIView *)logoView { if(_logoView == nil) { _logoView = [[UIImageView alloc] initWithImag...

Objective-C wrapper for ODF and ODS (OpenOffice)?

I'd like to import and export from a Cocoa application from/to OpenOffice format. Spreadsheets, in particular, but also potentially text. I've looked, but I can't seem to find the right combination of search words. ...

Objective-C Category import strange behavior

I am extending a class from a external library. Here is my code: Header file: Manager+MyCategory.h #import "Manager.h" #import "Element.h" @interface Manager (myCategory) - (Element*) elementWithTag:(NSInteger)tag; @end Implementation file: Manager+MyCategory.h file @implementation Manager (myCategory) - (Element*) elementWithT...

Regexkit lite and iPhone parsing

I've taken the suggestion of some posts here that recommend regexkit lite with a problem I am having with trying to extract a particular URL from a string. The problem is that I'm very lost with the syntax of using it and hoping someone that has used it can give me a hand. The string i'm trying to parse looks someting like this: <a> bl...

Cocoa KVC question: "class is not key value coding-compliant"

I'm trying to update some properties with KVC. The properties have been synthesized. This line works: myObject.value = intValue; This doesn't work: [self setValue:[NSNumber numberWithInt:intValue] forKey:@"myObject.value"]; And blows up with: Terminating app due to uncaught exception 'NSUnknownKeyException', reason: '[ setValue:f...

NSAffineTransforms not being used?

I have a subclass of NSView, and in that I'm drawing an NSImage. I'm unsing NSAffineTransforms to rotate, translate and scale the image. Most of it works fine. However, sometimes, the transforms just don't seem to get activated. For example, when I resize the window, the rotate transform doesn't happen. When I zoom in on the image, ...

How to customize NSTextField look (Font used, font size) in Cocoa ?

Hello everybody, I'm making a Cocoa application and I can't figure out how to do something. I want to make an NSTextField with a custom look like the one in Wallet : Wallet screenshot. I figured out how to change the NSTextField size but I don't know how to change the font and it size. I subclassed NSTextFieldCell like this but it ...

UIImage from bytes held in NSString

Hi all, I am trying to create a UIImage from a byte array that is actually held within a NSString. Can someone please tell me how I can do that? Here is what I was thinking of doing: NSString *sourceString = @"mYActualBytesAREinHERe="; //get the bytes const char *bytesArray = [sourceString cStringUsingEncoding:NSASCIIStringEncoding];...

Is there a more concise way to concatenate these strings in Cocoa?

NSString *latitude = [[NSString alloc] initWithFormat:@"%g°", coordinate.latitude]; NSString *longitude = [[NSString alloc] initWithFormat:@"%g°", coordinate.longitude]; self.pointLabel.text = [latitude stringByAppendingString:@", "]; self.pointLabel.text = [self.pointLabel.text stringByAppendingString:longitude]; ...

Using MPMediaPlaylistPropertyPlaylistAttributes and bitwise operators on NSInteger- Objective C (iPhone)

Hello, and thanks in advance for you time. I am trying to filter out certain types of playlists for an iphone app (genius and On-the-go, specifically). the documentation says that the property attribute MPMediaPlaylistPropertyPlaylistAttributes will return the attributes associated with a playlist in the form of an NSNumber containing a...

Be Alerted When SystemUIServer Restarts

Hi, I need to be able to be alerted either when SystemUIServer terminates, or when it launches, preferably terminates. The notification NSWorkspaceDidTerminateApplicationNotification isn't posted when launchd restarts it. Is there some way I can be alerted? --firen ...

Customizing UISlider appearance

I want to set the thumb image of a slider for a normal state, but still use the default track images. So i do this: [theSlider setThumbImage:[UIImage imageNamed:@"my_thumb.png"] forState: UIControlStateNormal]; and I get my image appear as thumb, but then default track images disappear. Can't you just customize the thumb image and ...

Logical error or is my program skipping parts?

FYI I'm programming in objective-C but anyone might be able to help. I've been sitting here for the past two hours trying to figure out what the problem is and I've done everything I know to debug this simple little coding problem. Check out the code below and I will explain. In the application, it starts out with MainScreenViewControlle...

Does a NSURLConnection retain its delegate?

Summary of my question: Does NSURLConnection retain its delegate? Detailed question and scenario: I have a custom class, called JsonDownloader that is takes in a URL and returns an NSDictionary of the JSON that the URL returns. On an iPhone app, I do something like this. (the init method kicks off the whole process) (void)viewDidLo...

Documentation for Objective C and Cocoa APIs?

Hi, Super-newbie question! I've been looking for a list of all the classes that come with Objective-C and Cocoa but can't seem to find one. Hoping that it has matching methods and syntax(?) as well. Be gentle with me! Thanks, Spencer. ...

How to debug a Screensaver in OS X

I was wondering if there was any decent way, other than NSLog-ing just about everything - to properly debug a Screensaver app bundle in OS X? The "Screensaver" is a project type in XCode, but there's obviously no Build and Go debugging. Further, I've found that in fact my bundle is getting loaded in to the /System/Library/Framework...

How can I disable the touch detection???

How can I disable the touch detection within the action that running, because I don't want the character flying in the sky like a superman if the player clicking and clicking within the action, the character will never land if they keep clicking. I found the method "isDone", is that relate to this method?? player click -> action(cannot c...

Get an address of an objective-c property (which is a C struct)

I have an objective-c class which contains a C style struct. I need to call a C function passing a pointer to this object member (a.k.a. property). For the life of me, I can't figure out how to get the address of this C struct. Using the traditional & operator to get the address, I'm getting an LValue compiler error. typedef struct ...

Real world examples of @optional protocol methods

I'm learning Objective-C at the moment and have come across optional methods in Protocols. My background is C# and can see a Protocol as something similar to a C# Interface. Where a C# Interface represents a contract, by advertising an Interface you are saying that you will implement the methods defined. With this in mind I'm confused ...

How do I make UILabel display outlined text?

All I want is a one pixel black border around my white UILabel text. I got as far as subclassing UILabel with the code below, which I clumsily cobbled together from a few tangentially related online examples. And it works but it's very, very slow (except on the simulator) and I couldn't get it to center the text vertically either (so I...