Skip to content

Commit b090fae

Browse files
author
yuvraj
committed
Change to improve memory usage
Stop reinitialising the objects calling initializeCamera method, and add [session startRunning]; that makes controller able to retake the photo. It resolves memory issue at some level.
1 parent bcc46bb commit b090fae

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

YCameraViewController/YCameraViewController.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -506,7 +506,8 @@ - (IBAction)retakePhoto:(id)sender{
506506

507507
haveImage=NO;
508508
FrontCamera = NO;
509-
[self performSelector:@selector(initializeCamera) withObject:nil afterDelay:0.001];
509+
// [self performSelector:@selector(initializeCamera) withObject:nil afterDelay:0.001];
510+
[session startRunning];
510511
}
511512

512513
- (IBAction)switchCamera:(UIButton *)sender { //switch cameras front and rear cameras

YImagePickerDemo/YImagePickerDemo/YCameraViewController/YCameraViewController.m

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,8 @@ - (IBAction)retakePhoto:(id)sender{
507507

508508
haveImage=NO;
509509
FrontCamera = NO;
510-
[self performSelector:@selector(initializeCamera) withObject:nil afterDelay:0.001];
510+
// [self performSelector:@selector(initializeCamera) withObject:nil afterDelay:0.001];
511+
[session startRunning];
511512
}
512513

513514
- (IBAction)switchCamera:(UIButton *)sender { //switch cameras front and rear cameras

YImagePickerDemo/YImagePickerDemo/YCameraViewController/YCameraViewController.xib

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="4510" systemVersion="12F45" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.XIB" version="3.0" toolsVersion="5053" systemVersion="13E28" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none">
33
<dependencies>
44
<deployment version="1280" defaultVersion="1536" identifier="iOS"/>
5-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3742"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="3733"/>
66
</dependencies>
77
<objects>
88
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="YCameraViewController">
@@ -96,7 +96,6 @@
9696
<color key="titleColor" red="0.19607843459999999" green="0.30980393290000002" blue="0.52156865600000002" alpha="1" colorSpace="calibratedRGB"/>
9797
<color key="titleShadowColor" white="0.5" alpha="1" colorSpace="calibratedWhite"/>
9898
</state>
99-
<state key="selected" image="filter-close.png"/>
10099
<state key="highlighted">
101100
<color key="titleColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
102101
</state>
@@ -196,7 +195,6 @@
196195
</view>
197196
</objects>
198197
<resources>
199-
<image name="filter-close.png" width="29" height="28"/>
200198
<image name="flash-off.png" width="25" height="25"/>
201199
<image name="flash.png" width="25" height="25"/>
202200
<image name="front-camera.png" width="47" height="23"/>
@@ -205,4 +203,4 @@
205203
<image name="library.png" width="27" height="27"/>
206204
<image name="take-snap.png" width="100" height="100"/>
207205
</resources>
208-
</document>
206+
</document>

0 commit comments

Comments
 (0)