Skip to content

Commit

Permalink
[iOS] Fixed resolution selector
Browse files Browse the repository at this point in the history
  • Loading branch information
Redth committed Aug 5, 2014
1 parent fa3a02a commit 8ca58c0
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/ZXing.Net.Mobile/iOS/ZXingScannerView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,14 @@ bool SetupCaptureSession ()
// See if the user selected a resolution
if (resolution != null) {
// Now get the preset string from the resolution chosen
var preset = consideredResolutions.FirstOrDefault (c =>
c.Value.Width == resolution.Width && c.Value.Height == resolution.Height);
var preset = (from c in consideredResolutions
where c.Value.Width == resolution.Width
&& c.Value.Height == resolution.Height
select c.Key).FirstOrDefault ();

// If we found a matching preset, let's set it on the session
if (preset != null && preset.Key != null)
session.SessionPreset = preset.Key;
if (!string.IsNullOrEmpty(preset))
session.SessionPreset = preset;
}

var input = AVCaptureDeviceInput.FromDevice (captureDevice);
Expand Down

0 comments on commit 8ca58c0

Please sign in to comment.