objective-c

iphone: How to mix enum like NSCalendar

I just looked at the code in NSCalendar.h like this: enum { NSEraCalendarUnit = kCFCalendarUnitEra, NSYearCalendarUnit = kCFCalendarUnitYear, NSMonthCalendarUnit = kCFCalendarUnitMonth, NSDayCalendarUnit = kCFCalendarUnitDay, NSHourCalendarUnit = kCFCalendarUnitHour, NSMinuteCalendarUnit = kCFCalendarUnitMinute, ...

Why I cannot overriding the ccTouchBegan method in CCSprite using cocas2d?

I am using cocos2d to develop a game. I used a TouchableSprite as follow: http://www.cocos2d-iphone.org/forum/topic/3196 So, I create a new class which is a sub class of TouchableSprite. But it have some problems.... See the code first: #import <Foundation/Foundation.h> #import "TouchableSprite.h"; @interface MySprite : TouchableSpri...

How do Objective-C function declarations work?

Hey, I was wondering how Objective-C function declarations worked, and why I would want to declare another function besides main. For example, I now that, at least from most programs I have been exposed to, Objective-C programs begin execution at the function named main, and the name main is therefore reserved. Now, the reason we usual...

iPhone: does animation stop selector run on the main thread?

The documentation is clear on the fact that animations (invoked with [UIView commitAnimations]) execute on a separate thread. What's not clear (to me, anyway) is whether the animationDidStopSelector is executed on the main (UI) thread or the same thread as the animation. Given the following code: - (void) doSomethingCool { // Fade ...

Converting an NSString to an NSInteger

if i have: NSString* number = @"2000"; Will NSInteger integerNumber = [number integerValue]; be equal to the integer representation of 2000? ...

Custom sorting using categories and core data - is it supported by the framework?

I'm developing for iPhone iOS 4.0 and I have a list of birthday objects (date + name) stored using Core Data. I want to use the NSFetchedResultsController to retrieve this list sorted by the next birthdate date of each birthday object. For that I need to define my own logic for the sort descriptor. I tried using: [NSSortDescriptor sort...

iPhone UINavigationController app design

Trying to wrap my head around how to structure an app around the UINavigationController. It seems to me that most explanations assume that the app always starts off at the root controller and drills down from there, but I'm unclear as to how this fits in with a login/registration step that happens before you get into the app. The struc...

Record Video/Take Picture switch in iPhone app?

So i got a iphone app that is a button and when you pressed it i want the camera view to pop up and i want to give the user a choice to take a picture or a video like in the default camera app the one switch thing. Thanks! ...

How to use the iPhone connect to server?

Hi, everyone, I want to ask a question about the iPhone application. I am writing an iPhone program which can connect to a server. However, I have not ideas which library of functions should I use in order to develop this program. Can anyone help me? Thank you very much. ...

problem with asynchronous programming while calling 2 methods in Objective-C

Hello, Inside ClassA: -(void)authenticateUser { authenticate_Obj = [classB_Obj authenticateMobileUser]; } Inside ClassB: -(AuthenticateObj*)authenticateMobileUser { [mobile_Obj AuthenticateMobileServer:self action:@selector(Handler:)]; return authenticate_G_Obj; } -(void)Handler:(id)value { authenticate_G_Obj = (Authenti...

What is the best method to find the highest subview that contains a cgpoint?

Is there a faster method than looping through a uiview's subviews and testing cgrectcontainspoint? ...

How to execute @selector method 1st in Objective-C/

Hello, How to make the @selector method execute 1st and then AuthenticateMobileServer in the below startement in Objective-C?Because AuthenticateMobileServer method is dependent on Handler logic. [mobile_Obj AuthenticateMobileServer:self action:@selector(Handler:)]; Please help. Thank You. ...

iPhone: playing .mp3 from http location

I am trying to play an MP3 file from a weblocation (http://domain.com/file.mp3). The only thing that seems to work is using the MPMoviePlayerController. Is this really the only option? I searched and read that AVPlayer should also be able to play such URLs but can't get it to work. ...

Passing array of custom objects to NSCell in NSMatrix programatically

I have an NSArray of custom NSObjects. Each object has some properties and an image that I would like to display in a grid view. NSMatrix appears to be a good solution to my problem, but I am having issues getting the content of the objects to display. Couple of things to note. I am not using core data I am trying to do this programm...

help! 20+ hours in code and now a bunch of errors that never happened before. Related to build and targets.Fixed:No FRAMEWORKS folder!

Help! Please I spent some 20+ hours working on a project and in the end I get a absolute specatular really weird failure of the code. I think it might have to do with where I am saving it and builds. Here are my errors: These never happened before and they are probably more related to where I am building? here is the really long error...

What is the Objective-C way of getting a nullable bool?

How should I go about getting a bool value that I can assign true, false and nil to in Objective-C? What is the Objective-C way of doing this? Much like C#'s Nullable. I'm looking to be able to be able to use the nil value to represent undefined. ...

Generating a DTMF tone doesn't work - application crashes!

Hi, I want to generate a custom DTMF tone and play it on the iPhone. In order to do so, I have created and allocated a memory buffer with a custom tone (ptr). Now I want to create a NSData object, initialized with the memory buffer, and pass it to AVAudioPlayer using initWithData:error: instance method. I wrote the following code, but ...

Fastest method for rendering a table view cell?

Hi, I'm developing an application that requires me to display many short strings of text in table cells. Currently, I'm using a default table view cell with about 14 UILabels added. Half of these labels contain static text that will not be changed, while the other half contains dynamic data that has to be updated when the table is scrol...

Does it make any sence to release ivars in appdelegate's dealloc?

Hi, I know that probably it's a good practice to release appdelegate's ivars in its dealloc method, but practically, does it makes any sence? As I understand the appdelegate of an iPhone app will live in memory while the application is running and all memory will be freed anyway when it's closed. Thank you ...

The best way to keep global variables in iPhone app

Hi everyone, I'm new to iPhone development so want to ask, what is the best way to keep global variables and constants which can be accessed by many classes? Shall I keep them in app delegate or there is a better way which I don't know? Thanks ...