Skip to content

Instantly share code, notes, and snippets.

@saiten
Created April 20, 2012 13:02
Show Gist options
  • Save saiten/2428326 to your computer and use it in GitHub Desktop.
Save saiten/2428326 to your computer and use it in GitHub Desktop.
Simple Light(meekapps/Simple-Light)をiOS4で光らせる
diff --git a/Simple Light/ViewController.h b/Simple Light/ViewController.h
index 21571f3..db2709d 100644
--- a/Simple Light/ViewController.h
+++ b/Simple Light/ViewController.h
@@ -13,6 +13,7 @@
AVCaptureDevice *captureDevice;
AVCaptureSession *captureSession;
+ AVCaptureVideoPreviewLayer *videoPreviewLayer;
BOOL mainOn;
BOOL strobeOn;
@@ -27,6 +28,7 @@
}
@property (nonatomic, retain) AVCaptureDevice *captureDevice;
@property (nonatomic, retain) AVCaptureSession *captureSession;
+@property (nonatomic, retain) AVCaptureVideoPreviewLayer *videoPreviewLayer;
@property (nonatomic) BOOL mainOn;
@property (nonatomic) BOOL strobeOn;
@property (nonatomic, retain) NSTimer *strobeTimer;
diff --git a/Simple Light/ViewController.m b/Simple Light/ViewController.m
index 567bf48..ce3b9f8 100644
--- a/Simple Light/ViewController.m
+++ b/Simple Light/ViewController.m
@@ -15,7 +15,7 @@
@implementation ViewController
@synthesize strobeTimer, mainOn, strobeOn, strobeDuration, batteryIndicator, calloutView, strobeButton, toggleButton, darknessOverlay, brightnessButton;
-@synthesize captureSession, captureDevice;
+@synthesize captureSession, captureDevice, videoPreviewLayer;
- (void)didReceiveMemoryWarning
{
@@ -197,6 +197,7 @@
error:nil];
self.captureSession = [[AVCaptureSession alloc] init];
+ self.videoPreviewLayer = [AVCaptureVideoPreviewLayer layerWithSession:self.captureSession];
[self.captureSession addInput:captureInput];
[self.captureSession startRunning];
@@ -238,7 +239,7 @@
//strobe button slider
UISlider *strobeSlider = [[UISlider alloc] initWithFrame:CGRectMake(9.5f, 39.0f, 190.0f, 30.0f)];
- strobeSlider.minimumTrackTintColor = [UIColor darkGrayColor];
+ //strobeSlider.minimumTrackTintColor = [UIColor darkGrayColor];
strobeSlider.minimumValue = kStrobeMin;
strobeSlider.maximumValue = kStrobeMax;
strobeSlider.value = (kStrobeMax + kStrobeMin) / 2.0f;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment