add preview layer before starting capture

git-svn-id: https://zxing.googlecode.com/svn/trunk@1580 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
smparkes@smparkes.net 2010-09-09 15:10:50 +00:00
parent ce3d27ed69
commit c19eb95cfc
2 changed files with 5 additions and 4 deletions

View file

@ -197,6 +197,7 @@
isa = PBXProject; isa = PBXProject;
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "ScanTest" */; buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "ScanTest" */;
compatibilityVersion = "Xcode 3.1"; compatibilityVersion = "Xcode 3.1";
developmentRegion = English;
hasScannedForEncodings = 1; hasScannedForEncodings = 1;
knownRegions = ( knownRegions = (
English, English,
@ -323,7 +324,7 @@
); );
IPHONEOS_DEPLOYMENT_TARGET = 4.0; IPHONEOS_DEPLOYMENT_TARGET = 4.0;
PREBINDING = NO; PREBINDING = NO;
SDKROOT = iphoneos4.0; SDKROOT = iphoneos4.1;
}; };
name = Debug; name = Debug;
}; };
@ -342,7 +343,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 4.0; IPHONEOS_DEPLOYMENT_TARGET = 4.0;
OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1";
PREBINDING = NO; PREBINDING = NO;
SDKROOT = iphoneos4.0; SDKROOT = iphoneos4.1;
}; };
name = Release; name = Release;
}; };

View file

@ -344,8 +344,6 @@
object:self.captureSession]; object:self.captureSession];
*/ */
[self.captureSession startRunning];
if (!self.prevLayer) { if (!self.prevLayer) {
self.prevLayer = [AVCaptureVideoPreviewLayer layerWithSession:self.captureSession]; self.prevLayer = [AVCaptureVideoPreviewLayer layerWithSession:self.captureSession];
} }
@ -353,6 +351,8 @@
self.prevLayer.frame = self.view.bounds; self.prevLayer.frame = self.view.bounds;
self.prevLayer.videoGravity = AVLayerVideoGravityResizeAspectFill; self.prevLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;
[self.view.layer addSublayer: self.prevLayer]; [self.view.layer addSublayer: self.prevLayer];
[self.captureSession startRunning];
#endif #endif
} }