objective-c

"hour" int taken from NSDate not behaving as expected at midnight??

I feel like I've lost my mind. Can someone tell me what's going on here? Also, I'm sure there is a better way to do what I'm trying to do, but I'm not interested in that now. I'd just like to solve the mystery of why my ints are not responding to logic as expected. // Set "At: " field close to current time NSDateFormatter *dateFormatter...

Adding procedural C openGL functions to an iPhone project

I want to add a few drawing functions to an iPhone project for drawing things. Something like drawTile(x,y,len,wid); which would call openGL to draw a box somewhere. I should just be able to write a procedural C file to do this but the openGL libraries are objective C and I'm getting weird errors. Do I have to make a class for all of my ...

How to replace a character in NSString without inserting a space?

Let's assume I have the string NSString* myString = @"Hello,"; How can I remove the comma without leaving a space? I have tried: NSString* newString = [myString stringByReplacingOccurrencesOfString:@"," withString:@""]; and NSString* newString = [myString stringByTrimmingCharactersInSet:[NSCharacterSet punctuationCharacterSet]]; ...

Case insensitive comparison NSString

Hi, Can anyone point me to any resources about case insensitive comparison in Objective C? It doesn't seem to have an equivalent method to str1.equalsIgnoreCase(str2) Thanks, Teja ...

iTunes Visualization -- What type of code is it written in and what does that code look like?

Being a web developer, I know how event driven user interfaces are written, but do not have insight into other families of code (embedded software like automotive software, automation software on assembly lines, drivers, or the crawling lower-thirds on CNN, etc.) I was looking at the iTunes visualizer (example) and am curious: What co...

Comparing floats in their bit representations

Say I want a function that takes two floats (x and y), and I want to compare them using not their float representation but rather their bitwise representation as a 32-bit unsigned int. That is, a number like -495.5 has bit representation 0b11000011111001011100000000000000 or 0xC3E5C000 as a float, and I have an unsigned int with the same...

Retrieving Spotlight query used to open document in application

If you search for something that opens Preview.app (e.g. a PDF file) in Spotlight, the application not only opens the file but actually copies the Spotlight query into the application's search field (for deeper search). iPhoto and Mail.app also do this. This is a really nice feature. Unfortunately, Apple does not document how it's imple...

Unable to access a primitive array inside a custom class from a UIViewController instance

Hello! I have made a subclass of NSObject that is meant to be the model of my application. The class has a few methods and on instance primitive array as such: @interface Cube : NSObject { int cubeState[5][2][2]; } - (void)printContent; @end @implementation Cube - (id)init { if (self = [super init]) { for (int i=0...

Getting redefinition of View Controller pickerView:titleForRow:forComponent error

Hi-- I'm working my way through the book Head First iPhone Development (O'Reilly). Am having trouble on page 68 with the following method and function; I get the error "redefinition of ViewController pickerView:titleForRow:forComponent error. Have checked the code for spaces; seems to be OK. Can you check the code and tell me what's wro...

Close button during modal sheet

In Objective C (Cocoa) I have an app running with a modal sheet, but I want to allow the app to quit even when the sheet is displayed (contradicting the definition of modal I think, but I like the animated effect of modal sheets). I'm already using the -setPreventsApplicationTerminationWhenModal method and it works fine, but I'm wonderi...

how can i change the size of (particular one)cell which is the part of uitableview(grouped) iphone ?

how can i change the size of (particular one)cell which is the part of uitableview(grouped) iphone ? ...

Can I assign array size using NSMutableArray?

I used to be a Java Programmer, which the array need to declare the very first time, like this: int[] anArray; // declares an array of integers anArray = new int[10]; // allocates memory for 10 integers I don't know whether the Objective C , NSMutableArray also give me this ability or not. Actually, I want to make a ...

How i access the array of CGPoints to draw the graph?

Hi, I have the code in which i want to develop the graph.The code is, NSArray *coordinate = [[NSArray alloc] initWithObjects: @"42,213", @"75,173", @"108,153", @"141,133", @"174,113", @"207,73", @"240,33", nil]; CGContextSetRGBFillColor(ctx, 255, 0, 0, 1.0); CGContextSetLineWidth(ctx, 8.0); for(int intIndex = 0; intIndex < [coordinate c...

how can i display a image on button which is presented on UINavigationController iphone ?

how can i display a image on button which is presented on UINavigationController iphone ? ...

encoding and decoding of a string using base128 in iphone sdk?

Hi guys, Can Anyone help me in encoding and decoding a string using base128 with a sample code. Anyone's help will be much appreciated. Thank you, Monish. ...

Get content length from UIWebView

I am looking to find out if a web page has changed, I was going to use the content length of the web page but have not seen a way to do so. Any ideas? Or can anyone think of another way to check periodically if a web page has changed? Any ideas are appreciated. Thanks, Chris ...

how can i customise the width of the cell which are the part of uitableview(grouped) in iphone ?

how can i customise the width of the cell which are the part of uitableview(grouped) in iphone ? ...

How to make the view bigger in interface builder - iphone

Im using a scroll view and need to make the view bigger so I can add the content that appears lower down but IB does allow me to do this? ...

Can we use (id) in if- else condition ?

I have written my code in following way in cocos2d. id actionTo = [CCFadeOut actionWithDuration:4.0f]; id actionTo0 = [CCSequence actionWithDuration:2.0f]; if (m < enemyNumber) id actionTo1 = [CCCallFunc actionWithTarget:self selector:@selector(goToNextScene)]; else id actionTo1 = [CCCallFunc actionWithTarget:self selector:@...

iphone image saving

I can save image to iPhone (iPhone Photo Albums \ Saved Photos) with UIImageWriteToSavedPhotosAlbum(image, onCompleteTarget, onCompleteSelector, contextInfoToCompleteSelector); But if there any way to check, if current image was already saved (to save it only once)? ...