Archive for December, 2009

links for 2009-12-22

  • It's always a pain when you have an ice cold import in your hand but can't locate your bottle opener, but odds are that you can locate your dog (if you have one, of course)

iPhone Dev: Adding the slide transition between views

The slide transition that’s used in the navigation controller is not a standard iPhone SDK transition. To add the slide transition (from right) between different UIViews use the following code

//1. Add the QuatzCore Framework from library to the Frameworks folder
//2. At the top include the header file

#import

//3. Implement the code

yourViewController = [[YourViewController alloc]
initWithNibName:@”YourViewController” bundle:nil];

//4. Add the transition in the method that moves to the next view
// get the view that’s currently showing
UIView *currentView = self.view;
// get the the underlying UIWindow, or the view containing the current view
UIView *theWindow = [currentView superview];

UIView *newView = yourViewController.view;

// remove the current view and replace with myView1
[currentView removeFromSuperview];
[theWindow addSubview:newView];

// set up an animation for the transition between the views
CATransition *animation = [CATransition animation];
[animation setDuration:0.5];
[animation setType:kCATransitionPush];
[animation setSubtype:kCATransitionFromRight];
[animation setTimingFunction:[CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]];

//5. The key is any unique string. From the CALayer class reference.
//key = “A string that specifies an identifier for the animation. Only one animation
//per unique key is added to the layer. The special key kCATransition is automatically
//used for transition animations. The nil pointer is also a valid key.”
[[theWindow layer] addAnimation:animation forKey:@”SwitchToNextView”];

Thanks to the participants at iphonedevsdk.com

links for 2009-12-14

links for 2009-12-12

links for 2009-12-11

links for 2009-12-04

links for 2009-12-01