diff --git a/DemoProject/NSGIF/Images.xcassets/AppIcon.appiconset/Contents.json b/DemoProject/NSGIF/Images.xcassets/AppIcon.appiconset/Contents.json index 118c98f..b8236c6 100644 --- a/DemoProject/NSGIF/Images.xcassets/AppIcon.appiconset/Contents.json +++ b/DemoProject/NSGIF/Images.xcassets/AppIcon.appiconset/Contents.json @@ -1,5 +1,15 @@ { "images" : [ + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "20x20", + "scale" : "3x" + }, { "idiom" : "iphone", "size" : "29x29", diff --git a/DemoProject/NSGIF/Info.plist b/DemoProject/NSGIF/Info.plist index 050b30b..5a8be32 100644 --- a/DemoProject/NSGIF/Info.plist +++ b/DemoProject/NSGIF/Info.plist @@ -40,5 +40,11 @@ UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight + NSCameraUsageDescription + This app uses your camera to take amazing photos. It works best when you allow. Thanks! + + NSMicrophoneUsageDescription + This app uses your camera to take amazing photos. It works best when you allow. Thanks! + diff --git a/DemoProject/NSGIF/ViewController.m b/DemoProject/NSGIF/ViewController.m index 2f73af5..ebdc59c 100644 --- a/DemoProject/NSGIF/ViewController.m +++ b/DemoProject/NSGIF/ViewController.m @@ -98,22 +98,22 @@ - (IBAction)button1Tapped:(id)sender { - (IBAction)button2Tapped:(id)sender { #if TARGET_IPHONE_SIMULATOR - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Oops!" message:@"You can't use the camera demo in the simulator. Try the video demo." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; - [alert show]; - return; + + UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Oops!" message:@"You can't use the camera demo in the simulator. Try the video demo." delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil, nil]; + [alert show]; + + #else + + UIImagePickerController *picker = [[UIImagePickerController alloc] init]; + picker.videoQuality = UIImagePickerControllerQualityTypeMedium; + picker.delegate = self; + picker.sourceType = UIImagePickerControllerSourceTypeCamera; + picker.mediaTypes = @[(NSString *)kUTTypeMovie]; + + // Present the picker + [self presentViewController:picker animated:YES completion:nil]; + #endif - - dispatch_async(dispatch_get_main_queue(), ^{ - - UIImagePickerController *picker = [[UIImagePickerController alloc]init]; - picker.videoQuality = UIImagePickerControllerQualityTypeMedium; - picker.delegate = self; - picker.sourceType = UIImagePickerControllerSourceTypeCamera; - picker.mediaTypes = @[(NSString *)kUTTypeMovie]; - - // Present the picker - [self presentViewController:picker animated:YES completion:nil]; - }); } - (IBAction)button3Tapped:(id)sender { @@ -134,9 +134,8 @@ - (IBAction)button3Tapped:(id)sender { request.aspectRatioToCrop = CGSizeMake(4,3); request.frameCount = 10; - [NSGIF extract:request completion:^(NSArray *extractedFrameImageUrls) { - NSLog(@"Finished generating frames: %@", extractedFrameImageUrls); - + [NSGIF extract:request completion:^(NSFrameExtractingResponse * response) { + [self.activityIndicator stopAnimating]; [UIView animateWithDuration:0.3 animations:^{ self.button1.alpha = 0.0f; @@ -144,16 +143,17 @@ - (IBAction)button3Tapped:(id)sender { self.button3.alpha = 0.0f; self.webView.alpha = 1.0f; }]; - - for(NSURL * imageUrl in extractedFrameImageUrls){ + + for(NSURL * imageUrl in response.imageUrls){ UIImage * image = [UIImage imageWithContentsOfFile:imageUrl.path]; UIView * imageView = [[UIImageView alloc] initWithImage:image]; imageView.contentMode = UIViewContentModeScaleAspectFit; - imageView.frame = CGRectMake(0,((CGFloat)[extractedFrameImageUrls indexOfObject:imageUrl])*(image.size.height/6), image.size.width/6,image.size.height/6); + imageView.frame = CGRectMake(0,((CGFloat)[response.imageUrls indexOfObject:imageUrl])*(image.size.height/6), image.size.width/6,image.size.height/6); imageView.clipsToBounds = YES; imageView.layer.borderWidth = 1; [scrollView addSubview:imageView]; } + }]; [self.view addSubview:scrollView]; diff --git a/NSGIF/NSGIF.h b/NSGIF/NSGIF.h index 752ebfe..8497695 100644 --- a/NSGIF/NSGIF.h +++ b/NSGIF/NSGIF.h @@ -118,7 +118,7 @@ typedef void (^ NSGIFProgressHandler)(double progress, NSUInteger offset, NSUInt #pragma mark NSSerializedResourceResponse @interface NSSerializedResourceResponse : NSObject -@property(nonatomic, readonly) NSArray * imageUrls; +@property(nullable, nonatomic, readonly) NSArray * imageUrls; @end