New
Goodness Christopher M. Judd
Thursday, October 24, 13
Christopher M. Judd CTO and Partner at leader Columbus
Thursday, October 24, 13
Developer User Group (CIDUG)
Thursday, October 24, 13
Thursday, October 24, 13
Agenda
UIKit Dynamics Multitasking MapKit
Thursday, October 24, 13
UIKit Dynamics
Thursday, October 24, 13
physics and animation
Thursday, October 24, 13
Thursday, October 24, 13
Thursday, October 24, 13
UIGravityBehavior UICollisionBehavior UIPushBehavior UIAttachmentBehavior UISnapBehavior UIDynamicItemBehavior
Thursday, October 24, 13
Demo
Thursday, October 24, 13
UIDynamicAnimator
UIDynamicBehavior
UIDynamicItem
Thursday, October 24, 13
UIView
UIGravityBehavior
UIView
Thursday, October 24, 13
#import "MSDDViewController.h" @interface MSDDViewController () @property (nonatomic, strong) UIDynamicAnimator *animator; @property (nonatomic, strong) UIGravityBehavior *gravityBehavior; @end @implementation MSDDViewController - (void)viewDidLoad { [super viewDidLoad]; UIDynamicAnimator *animator = [[UIDynamicAnimator alloc] initWithReferenceView:self.view]; self.animator = animator;
}
UIGravityBehavior *gravityBehavior = [[UIGravityBehavior alloc] initWithItems:nil]; [self.animator addBehavior: gravityBehavior]; self.gravityBehavior = gravityBehavior;
- (IBAction)drop:(id)sender { UIView *box = [[UIView alloc] initWithFrame:CGRectMake(412, 0, 100, 100)]; box.backgroundColor = [self randomColor]; [[self view] addSubview:box]; }
[self.gravityBehavior addItem:box];
- (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } - (UIColor*)randomColor { CGFloat hue = ( arc4random() % 256 / 256.0 ); // 0.0 to 1.0 CGFloat saturation = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0, away from white CGFloat brightness = ( arc4random() % 128 / 256.0 ) + 0.5; // 0.5 to 1.0, away from black return [UIColor colorWithHue:hue saturation:saturation brightness:brightness alpha:1]; } @end Thursday, October 24, 13
Thursday, October 24, 13
#import "MSDDViewController.h" @interface MSDDViewController () @property (nonatomic, strong) UIDynamicAnimator *animator; @property (nonatomic, strong) UIGravityBehavior *gravityBehavior; @property (nonatomic, strong) UICollisionBehavior *collisionBehavior; @end @implementation MSDDViewController - (void)viewDidLoad { [super viewDidLoad]; UIDynamicAnimator *animator = [[UIDynamicAnimator alloc] initWithReferenceView:self.view]; self.animator = animator; UIGravityBehavior *gravityBehavior = [[UIGravityBehavior alloc] initWithItems:nil]; [self.animator addBehavior: gravityBehavior]; self.gravityBehavior = gravityBehavior;
}
UICollisionBehavior *collisionBehavior = [[UICollisionBehavior alloc] initWithItems:nil]; collisionBehavior.translatesReferenceBoundsIntoBoundary = YES; collisionBehavior.collisionMode = UICollisionBehaviorModeEverything; collisionBehavior.collisionDelegate = self; [self.animator addBehavior:collisionBehavior]; self.collisionBehavior = collisionBehavior;
- (IBAction)drop:(id)sender { UIView *box = [[UIView alloc] initWithFrame:CGRectMake(412, 0, 100, 100)]; box.backgroundColor = [self randomColor]; [[self view] addSubview:box];
} @end
Thursday, October 24, 13
[self.gravityBehavior addItem:box]; [self.collisionBehavior addItem:box];
Thursday, October 24, 13
Thursday, October 24, 13
https://developer.apple.com/library/ios/samplecode/DynamicsCatalog/Introduction/Intro.html Thursday, October 24, 13
New Multitasking
Thursday, October 24, 13
content updates
Thursday, October 24, 13
Thursday, October 24, 13
Background Fetch
Thursday, October 24, 13
Thursday, October 24, 13
#import "MSBFAppDelegate.h" @implementation MSBFAppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [application setMinimumBackgroundFetchInterval:UIApplicationBackgroundFetchIntervalMinimum]; return YES; } - (void)application:(UIApplication *)application performFetchWithCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler { NSLog(@"Background Fetching...."); //fetch the latest content completionHandler(UIBackgroundFetchResultNewData); } ! ! ! ! ! ! ! @end
Thursday, October 24, 13
Debug > Simulate Background Fetch
Thursday, October 24, 13
Remote Notifications
Thursday, October 24, 13
Thursday, October 24, 13
#import "MSBFAppDelegate.h" @implementation MSBFAppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [[UIApplication sharedApplication] registerForRemoteNotificationTypes: (UIRemoteNotificationTypeNewsstandContentAvailability| UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound | UIRemoteNotificationTypeAlert)]; }
return YES;
- (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))handler { NSDictionary *apsInfo = [userInfo objectForKey:@"aps"]; if( [apsInfo objectForKey:@"content-available"] != NULL) { NSLog(@"Silently ReceiveRemoteNotification..."); } }
aps { content-available: 1 }
Thursday, October 24, 13
Background Transfer Service
Thursday, October 24, 13
NSString *googleBooksUrl = @"https://www.googleapis.com/books/v1/volumes?q=ios"; NSURLSession *session = [NSURLSession sharedSession]; [[session dataTaskWithURL:[NSURL URLWithString:googleBooksUrl] completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) { NSLog(@"Received content..."); completionHandler(UIBackgroundFetchResultNewData); }] resume];
Thursday, October 24, 13
Thursday, October 24, 13
MapKit
Thursday, October 24, 13
Overlay levels MKCamera (position, tilt, heading) MKMapSnapshotter MKDirections & MKRoute(route-information) MKGeodesicPolyline MKOverlayRender (replaces overlay views) MKTileOverlay & MKTileOverlayRender Thursday, October 24, 13
Pitch Heading Altitude
mapView.camera.pitch = 45.0;
Thursday, October 24, 13
Christopher M. Judd CTO and Partner email:
[email protected] web: www.juddsolutions.com blog: juddsolutions.blogspot.com twitter: javajudd
Thursday, October 24, 13