Skip to content
This repository has been archived by the owner on Jul 1, 2022. It is now read-only.

Camera preview fix #160

Merged
merged 3 commits into from
Apr 10, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion ALCameraViewController/ViewController/CameraViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,6 @@ open class CameraViewController: UIViewController {
}

internal func saveImage(image: UIImage) {

let spinner = showSpinner()
cameraView.preview.isHidden = true

Expand Down Expand Up @@ -600,4 +599,21 @@ open class CameraViewController: UIViewController {
spinner.removeFromSuperview()
}

private func showSpinner() -> UIActivityIndicatorView {
let spinner = UIActivityIndicatorView()
spinner.activityIndicatorViewStyle = .white
spinner.center = view.center
spinner.startAnimating()

view.addSubview(spinner)
view.bringSubview(toFront: spinner)

return spinner
}

private func hideSpinner(_ spinner: UIActivityIndicatorView) {
spinner.stopAnimating()
spinner.removeFromSuperview()
}

}