Skip to content

Commit

Permalink
Manually merged in the details for Redth#37 Closes Redth#37
Browse files Browse the repository at this point in the history
  • Loading branch information
Redth committed Jun 17, 2013
1 parent 2082bf3 commit 90802c9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 24 deletions.
2 changes: 1 addition & 1 deletion samples/MonoTouch/MonoTouch.Sample/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
<key>CFBundleDisplayName</key>
<string>ZXing Sample</string>
<key>MinimumOSVersion</key>
<string>6.0</string>
<string>5.0</string>
</dict>
</plist>
52 changes: 29 additions & 23 deletions src/ZXing.Net.Mobile/MonoTouch/ZXingScannerView.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
using System;
using MonoTouch.Foundation;
using MonoTouch.CoreFoundation;
using MonoTouch.UIKit;
using MonoTouch.AVFoundation;
using System.Collections.Generic;
using System.Drawing;
using System.Threading;
using System.Threading.Tasks;
using MonoTouch.AVFoundation;
using MonoTouch.CoreFoundation;
using MonoTouch.CoreGraphics;
using MonoTouch.CoreMedia;
using MonoTouch.CoreVideo;
using MonoTouch.CoreGraphics;
using ZXing.Mobile;
using MonoTouch.Foundation;
using MonoTouch.ObjCRuntime;
using MonoTouch.UIKit;
using ZXing.Common;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Threading;
using ZXing.Mobile;

namespace ZXing.Mobile
{
Expand Down Expand Up @@ -211,7 +212,9 @@ bool SetupCaptureSession ()
previewLayer = new AVCaptureVideoPreviewLayer(session);

//Framerate set here (15 fps)
previewLayer.Connection.VideoMinFrameDuration = new CMTime(1, 10);
if (previewLayer.RespondsToSelector(new Selector("connection")))
previewLayer.Connection.VideoMinFrameDuration = new CMTime(1, 10);

previewLayer.LayerVideoGravity = AVLayerVideoGravity.ResizeAspectFill;
previewLayer.Frame = this.Frame;
previewLayer.Position = new PointF(this.Layer.Bounds.Width / 2, (this.Layer.Bounds.Height / 2));
Expand Down Expand Up @@ -346,20 +349,23 @@ public void ResizePreview (UIInterfaceOrientation orientation)
{
previewLayer.Frame = this.Frame;

switch (orientation)
if (previewLayer.RespondsToSelector(new Selector("connection")))
{
case UIInterfaceOrientation.LandscapeLeft:
previewLayer.Connection.VideoOrientation = AVCaptureVideoOrientation.LandscapeLeft;
break;
case UIInterfaceOrientation.LandscapeRight:
previewLayer.Connection.VideoOrientation = AVCaptureVideoOrientation.LandscapeRight;
break;
case UIInterfaceOrientation.Portrait:
previewLayer.Connection.VideoOrientation = AVCaptureVideoOrientation.Portrait;
break;
case UIInterfaceOrientation.PortraitUpsideDown:
previewLayer.Connection.VideoOrientation = AVCaptureVideoOrientation.PortraitUpsideDown;
break;
switch (orientation)
{
case UIInterfaceOrientation.LandscapeLeft:
previewLayer.Connection.VideoOrientation = AVCaptureVideoOrientation.LandscapeLeft;
break;
case UIInterfaceOrientation.LandscapeRight:
previewLayer.Connection.VideoOrientation = AVCaptureVideoOrientation.LandscapeRight;
break;
case UIInterfaceOrientation.Portrait:
previewLayer.Connection.VideoOrientation = AVCaptureVideoOrientation.Portrait;
break;
case UIInterfaceOrientation.PortraitUpsideDown:
previewLayer.Connection.VideoOrientation = AVCaptureVideoOrientation.PortraitUpsideDown;
break;
}
}
}

Expand Down

0 comments on commit 90802c9

Please sign in to comment.