Commit 0d503a05 by Daniel Dahan

aligned NavigationBarView and fixed fault in callback for timer update

parent d3b4ccc1
......@@ -36,8 +36,8 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg
}
private func prepareCameraView() {
cameraView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(cameraView)
cameraView.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.alignToParent(view, child: cameraView)
}
......
......@@ -40,15 +40,18 @@ public class CameraView : CaptureView, CaptureViewDelegate, CaptureSessionDelega
*/
public override func prepareView() {
super.prepareView()
prepareNavigationBarView()
prepareCaptureButton()
prepareCameraButton()
prepareVideoButton()
prepareCloseButton()
prepareSwitchCameraButton()
prepareFlashButton()
prepareNavigationBarView()
}
/**
:name: captureViewDidUpdateRecordTimer
*/
public func captureViewDidUpdateRecordTimer(captureView: CaptureView, duration: CMTime, time: Double, hours: Int, minutes: Int, seconds: Int) {
MaterialAnimation.animationDisabled {
self.navigationBarView.titleLabel!.text = String(format: "%02i:%02i:%02i", arguments: [hours, minutes, seconds])
......@@ -56,6 +59,9 @@ public class CameraView : CaptureView, CaptureViewDelegate, CaptureSessionDelega
}
/**
:name: captureViewDidStopRecordTimer
*/
public func captureViewDidStopRecordTimer(captureView: CaptureView, duration: CMTime, time: Double, hours: Int, minutes: Int, seconds: Int) {
navigationBarView.titleLabel!.hidden = true
navigationBarView.detailLabel!.hidden = true
......@@ -236,6 +242,7 @@ public class CameraView : CaptureView, CaptureViewDelegate, CaptureSessionDelega
addSubview(navigationBarView)
navigationBarView.translatesAutoresizingMaskIntoConstraints = false
MaterialLayout.alignFromTop(self, child: navigationBarView)
MaterialLayout.alignToParentHorizontally(self, child: navigationBarView)
MaterialLayout.height(self, child: navigationBarView, height: 70)
}
......
......@@ -29,12 +29,12 @@ public protocol CaptureViewDelegate : MaterialDelegate {
/**
:name: captureViewDidUpdateRecordTimer
*/
optional func captureViewDidUpdateRecordTimer(captureView: CaptureView, duration: CMTime, time: Double, hours: Int, minutes: Int, seconds: Int)
optional func captureViewDidUpdateRecordTimer(captureView: CaptureView, hours: Int, minutes: Int, seconds: Int)
/**
:name: captureViewDidStopRecordTimer
*/
optional func captureViewDidStopRecordTimer(captureView: CaptureView, duration: CMTime, time: Double, hours: Int, minutes: Int, seconds: Int)
optional func captureViewDidStopRecordTimer(captureView: CaptureView, hours: Int, minutes: Int, seconds: Int)
/**
:name: captureViewDidTapToFocusAtPoint
......@@ -195,7 +195,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate {
let hours: Int = Int(time / 3600)
let minutes: Int = Int((time / 60) % 60)
let seconds: Int = Int(time % 60)
(delegate as? CaptureViewDelegate)?.captureViewDidUpdateRecordTimer?(self, duration: duration, time: time, hours: hours, minutes: minutes, seconds: seconds)
(delegate as? CaptureViewDelegate)?.captureViewDidUpdateRecordTimer?(self, hours: hours, minutes: minutes, seconds: seconds)
}
/**
......@@ -209,7 +209,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate {
let seconds: Int = Int(time % 60)
timer?.invalidate()
timer = nil
(delegate as? CaptureViewDelegate)?.captureViewDidStopRecordTimer?(self, duration: duration, time: time, hours: hours, minutes: minutes, seconds: seconds)
(delegate as? CaptureViewDelegate)?.captureViewDidStopRecordTimer?(self, hours: hours, minutes: minutes, seconds: seconds)
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment