All 4 States of Stack Transitions for iOS

Animate or do special things for each of the 4 state transitions of a View Controller

This fills a need for when I want to do different animations depending on which transition a View Controller is happening.

We’re going to do different animations when View Controllers are pushed or popped from the stack. We’ll start with 4 states, being ‘pushed’, ‘popped’, ‘put back’ and ‘popped to’.

‘Pushed On’ is when you add a new View Controller to the stack and it is now visible.
‘Popped’ is when your view controller was visible and it is transitioning to be gone.
‘Put Back’ is when your view controller was visible and another one is going on top of it.
‘Popped to’ is when your view controller was in the stack and the one on top was just popped.
If you want to slow things down do ‘Slow Animations’ ⌘-T or in the menu Debug->Slow Animations.

FlurryAds Interstitial ads with Cocos2d v3

This is my first foray into ad-supported territory. I am really liking Cocos2d and recently my focus has been on the newest v3 (currently rc4). In this tutorial we will put up some interstitial ads for iphone and/or ipad.

Cocos2d v3 has a great new installer. It gives you a couple options in XCode. It’s even compatible with the latest XCode (5.1) and ARC.

-all those frameworks.
AdSupport.framework (Mark as Optional to support < iOS 6.0)
StoreKit.framework (Mark as Optional to support < iOS 6.0)

//do the first delegate stuff
In the AppDelegate.h go into the
-(BOOL) application: didFinishLaunchingWithOptions:

[Flurry setCrashReportingEnabled:YES];
[Flurry startSession:@"YOUR_API_KEY"];
[FlurryAds enableTestAds:YES];

Continue reading

Easy way to see (and debug) UILocalNotifications

It doesn’t take a lot of code to create a UILocalNotification but when you have multiple of them and you’re doing a lot of calendar math and things start getting hairy. To demystify that experience I created a project with a UITableViewController that prints out all of the current UILocalNotifications.

We’ll create 3 local notifications 1 minute apart for the next 3 minutes with these calls:

   [self createLocalNoticationAt:[[NSDate date] dateByAddingTimeInterval:60] withTitle:@"Every Minute 1!"];
    [self createLocalNoticationAt:[[NSDate date] dateByAddingTimeInterval:120] withTitle:@"Every Minute 2!"];
    [self createLocalNoticationAt:[[NSDate date] dateByAddingTimeInterval:180] withTitle:@"Every Minute 3!"];

Continue reading