objective-c

Core Data (iPhone)- Limiting the fetch results across a relationship

I have recently been looking at Core Data for the iPhone and I have one query which I have not been able to find an answer to in the literature. Lets imagine that I have a User model object with a to-many relationship with a Purchase object. A User may have thousands of purchases. All of the information I have seen thus far seems to su...

iPhone: Quartz2d vs. OpenGL ES

OK, I'm still brand new to iPhone development. I have a free game on the app store, Winner Pong, but it's just a Pong clone (who would've guessed) that uses the standard UIImageViews for the sprites. Now I want to do something a little more complicated, and port my game for the Xbox 360, Trippin Alien, to the iPhone. I obviously can't ke...

make a timer count down and score displayed on the screen in Cocos2D

Hi everyone How can I apply a timer count down in Cocos2D and the score counter that both will be display on the screen? I am still new to this Please help me out Thanks a lot ...

iPhone - NSString value not being set.

Inside of a UIViewController, I am executing the following: TVController* stopTimes = [ [ TVController alloc ] initWithStyle: UITableViewStyleGrouped ]; stopTimes.tableView.frame = CGRectMake( 0, 180, 320, 280 ); stopTimes.tableView.backgroundColor = [ UIColor whiteColor ]; stopTimes.theID = stopID; [ self.view addSubview: stopTimes.ta...

Detecting Swipe In UINavigationBar

I am trying to get my view controller to detect swipes in the UINavigationBar that is automatically displayed by my app, but it refuses to detect swipes. Is there any way I can do it? ...

Displaying of fractional values using a NSNumberFormatter?

My requirement is to display fractional values if the user wants to enter the fractional values in the text fields. I haver a textfield where i should display the values entered seperated with commas and also it should allow to enter only 9 integer digits and 2 digits after decimal point(Fractional Values). I have tried using the NSNumbe...

Interface Builder won't connect button, but the tutorial says it should work...

I've been trying to learn Core Data, and browsing through questions on Stack Overflow lead me to a recommendation that I try the tutorial on Core Data over at Cocoa Dev Central (Link). Everything is making sense so far in the tutorial, but when I got to step 16, it wouldn't let me connect the + button to the Posts array controller. I'v...

How to release attribute which is protocol?

Hi, everyone. I have working for iPhone development for a while. First time, I so surprised with memory-management in objective-c :). but now I got it a little bit. The question is, sometime, I use protocol as an attribute of a class, because I think its definition very similar to 'interface' in C# or Java. like below. @protocol Shiel...

iPhone: how to remove badge after Push Notification?

Hi guys, What is the code to remove the badge on my app's icon? When I receive push, I need to remove it when a button is clicked! ...

How do we check if the iphone is on standby mode?

How can we check if the iphone has gone into a standby mode and returns from that mode programmaticlly? I am using this to force it not to sleep during the game: application.idleTimerDisabled = YES; But if the user uses the sleep button it messes up with my game state in my code. Any help would be appreciated, thanks in advanced. ...

Core-Data: Print contents of an entity

Hi all, How would I print the contents of an entity e.g. customer? I want the data to be table like, e.g. the entity data should print like so: First Name | Last Name | Telephone Number | Email | DOB I also need to apply a search predicate before printing the data, e.g. print members born after 1984 Could anybody tell me how I should...

Changing provided services based on user preferences in OSX?

Hi, I would like to be able to change the OSX services that my application provides based on the current user's preferences (like adding more, changing the name,...). This basically means modifying the Info.plist (NSService key), but I don't think it is a good practice when an application modifies its own Info.plist while running, right...

Using file as input, iPhone App

I have iPhone Library in c (it is created from c source in MAC). There is a method that read a file using file path. Now I want to input the file path in Objective-C to that method. My questions are: Is it possible to do? I mean use c library to read file on iPhone. if it is possible, Where is the location in my project to put the ...

iPhone Development xcode : Putting user input (names) into text array

I am trying to load names in an array using UIAlert and then print them one by one. I can not figure this out can anyone help me with this. I would really your help apprecaite ...

Is anyone have memory leaks using cocos2d?

I am detecin a memory leak particularily in the startAnimation method in the director object. - (void) startAnimation { if ( gettimeofday( &lastUpdate, NULL) != 0 ) { CCLOG(@"cocos2d: DisplayLinkDirector: Error on gettimeofday"); } // approximate frame rate // assumes device refreshes at 60 fps int frameInterva...

Interacting with IPhone while in sleep mode

I want my app to keep running and interacting with the user, even if the user presses the sleep button. So far I have learned, that my app can stay alive with the following code: NSTimer *timer = [NSTimer timerWithTimeInterval:0.5 target:self selector:@selector(timerFireMethod:) userInfo:nil repeats:YES]; [[NSRunLoop currentRunLoop] ad...

Xcode documentation links behave crazy

The links in Xcode documentation, that mean the methods in the "Tasks" for example, when i only put the mouse on the links, then the page go up. What happen to Xcode? ...

Using -setValue:forKey: vs "object.var = ..."

The difference between these two lines of code is that the second is KVO compliant and the first isn't? [person setValue:tempPerson.name forKey:@"name"]; person.name = tempPerson.name; The reason I'm asking is because I need to update 60 attributes on over 500 objects, I don't want KVO notifications for more than a handful of attribut...

NSString immutable allows to change its values?

The code below compiles and runs, BUT according to all iPhone development books and Apple documentation it shouldnt! Can someone please explain to me how come immutable NSString allows to change its values after it has been set? I thought I had to use NSMuttableString to change context of the same string variable? I am using SDK 3.1. N...

Creating an IMP from an Objective-C block

The IMP type in Objective-C represents a function pointer, as far I as understand. Is there any way to make an IMP from a block pointer? Thanks for your ideas. UPDATE: Thanks, @bbum, for your great solution. I haven't modified my code to use it yet, but everyone can see the fruits of my labors here: A new metaclass for Objective-C. ...