objective-c

Custom easing action with Cocos2D-iphone

How would one go about creating a custom action in Cocos2D that was able to perform a 'callback' over time, making each call to the callback progressively longer than the last call to it (using something similar to the EaseExponentialOut action already provided with Cocos2D. Something similar to this: (which does not work) id sequence ...

how to extract data from cocoa iPhone sax xml parsing routine

I'm trying to read in and parse an xml document in an iPhone app. I begin parsing and then use the override method: static void startElementSAX(void *ctx, const xmlChar *localname, const xmlChar *prefix, const xmlChar *URI, int nb_namespaces, const xmlChar **namespaces, int nb_attributes, int nb_defaulted, c...

how does an objective-c xmlchar data type work

In objective c how does an xmlchar data type work? I can't seem to find any API documentation. Specifically my declaration looks like: const xmlChar **attributes Am I classifying this correctly by saying it's an objective c data type or is it specific to cocoa or just C? ...

Arrays in Objective-C main method. Sigserve errors. Newb.

In Objective-C how should I best approximate what in Java I am doing like this: static private String[] array {"A", "B", "C"}; What I think I need is a simple array that I can index into with some integers. Alternative suggestions are welcome, but bear in mind that if I am getting stuck on this then I am pretty much hopeless anyway...

Is it better to start how to code in Objective-C for the desktop before you venture to the iPhone?

I have C/C++ experience so learning Objective-C is not completely foreign to me. However, I noticed that writing an application for the iPhone is not as simple as for the desktop platform. Should I start to get some solid experience on the desktop before I jump into the iPhone? I am not a commercial developer, and merely doing this as a ...

objective-c: how to define

Hi, I want to define a following function: if(stmtToFinalize) { NSLog(@"Finalizing statement stmtToFinalize"); if (sqlite3_finalize(stmtToFinalize) !=SQLITE_OK) NSLog(@"An error occured while trying to finalize a statement stmtToFinalize: '%s'", sqlite3_errmsg(database)); stmtToFinalize = NULL; } But I am ...

iPhone Persistent Storage

I need to store certain information while my application is executing and again fetch it at the time the application starts. I tried storing it in XML using GData but didn't succeed. I used the NSFileHandle it doesn't give me an error but it fails to create a .txt file for read / write purpose. Is there any other way of storing and retri...

Using constant variables in Objective-C expressions? Newb.

In Java static final int VCount = 21, TCount = 28, NCount = VCount * TCount; in Objective-C static int VCount = 21, TCount = 28, NCount = ???; How can I express the NCount int because it refers to variables? ...

Using Cocoa to detect when a running application plays audio

I'm looking into writing an app that runs as a background process and detects when an app (say, Safari) is playing audio. I can use NSWorkspace to get the process ID's of the currently running applications but I'm at a loss when it comes to detecting what those processes are doing. I assume that there is a way to listen in on a process a...

How to show a loading label above a UITableView??

I have a UITableView that I populate with data that i download over the internet. While the data is being downloaded, I want to show a loading label above my TableView to signify to users that something is actually happening and there is not a problem with the app. What is the best way to do this?? ...

UIViewControllers and UIViews... how to architect a simple app

I'm a bit confused about how many controllers I need, and when I can load in UIViews into the same controller, versus having two controllers for two separate UIViews. Here's my current situation. I have a simple app that takes in information on the beginning screen, and then based on the info from the user (via a UIPicker and a text...

How to read data structure from .plist file into NSArray

I was creating a data structure manually using the following: NSDictionary* league1 = [[NSDictionary alloc] initWithObjectsAndKeys: @"Barclays Premier League", @"name", @"Premier League", @"shortname", @"101", @"id", nil]; NSDictionary* league2 = [[NSDictionary alloc] initWithObjectsAndKeys: @"Coca-Cola Championship", @"...

Accessing Views created in Interface Builder

I've created a ChildViewController class, and then a nib that uses that class. Then I created a BaseView, that includes some buttons, and some text that I'll be changing programmatically. Then I created two more views (Boy and Girl), that I want to be able to lay behind the baseview so that the background color is different along w...

Using TwitPic API from ObjectiveC/iPhone

There's a similar question on here about this which I've read and I've tried to follow the advice given there... and I think I'm 95% complete but the remaining 5%... well you know ;-) So I'm trying to call the twitPic API to upload an image and I've got the image contained in a UIImageView which I'm displaying on the screen (I can see i...

How do you check for sanity in objective-c and cocoa?

What is the preferred method of checking for sanity in objective-c and cocoa? ...

Setting a ViewController's properties after instantiation

I'm creating an instance of a viewController, and then trying to set the text on of it's properties, a UILabel. BoyController *boyViewController = [[BoyController alloc] initWithNibName:@"BoyView" bundle:nil]; NSString *newText = [astrology getSignWithMonth:month withDay:day]; boyViewController.sign.text = newText; NSLo...

iphone: accessing sqlite3 database

I have created database and table through sqlite3 using termnal on macbook,then deploy it on my iphone's application.Its working fine with simulator i.e inserting & retriving the values from table. but when i install it on real iphone it is not working, why? I think it can not get the path of databse,then how can i do that?? plz help me ...

How can I get the class object, when I only know the classname at runtime in Objective-C

Hi there, I need to get the class object out of a string, containing the name of the class at runtime. I found a function called objc_getClass, but I'm not sure if it's really what I search. Can I implement it like this? NSString *name = @"AnyClass"; Class *myClass = objc_getClass([name UTF8String]); ...

Rounding numbers in Objective-C

Hi, I'm trying to do some number rounding and conversion to a string to enhance the output in an Objective-C program. I have a float value that I'd like to round to the nearest .5 and then use it to set the text on a label. For example: 1.4 would be a string of: 1.5 1.2 would be a string of: 1 0.2 would be a string of: 0 I've spe...

Error on defining an array even though its set via a Constant...

Hi, I know this is really basic, but its got me stumped... In Objective-C I'm trying to write: const int BUF_SIZE = 3; static char buffer[BUF_SIZE+1]; But I get a storage size of buffer isn't constant. How do I make Xcode realise that I'm setting it to a constant, + 1...? Or is this not possible...? Thanks...! Joel ...