Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
60626aba
Commit
60626aba
authored
Dec 14, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated CaptureView to not call flashButton handle
parent
30b1d92e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
44 deletions
+14
-44
Examples/Programmatic/CaptureView/CaptureView/ViewController.swift
+9
-4
Sources/CaptureView.swift
+5
-40
No files found.
Examples/Programmatic/CaptureView/CaptureView/ViewController.swift
View file @
60626aba
...
@@ -96,17 +96,22 @@ class ViewController: UIViewController, CaptureSessionDelegate {
...
@@ -96,17 +96,22 @@ class ViewController: UIViewController, CaptureSessionDelegate {
internal
func
handleFlash
(
sender
:
AnyObject
)
{
internal
func
handleFlash
(
sender
:
AnyObject
)
{
var
img
:
UIImage
?
var
img
:
UIImage
?
switch
captureView
.
previewView
.
captureSession
.
flashMode
{
switch
captureView
.
captureSession
.
flashMode
{
case
.
Off
:
case
.
Off
:
img
=
UIImage
(
named
:
"ic_flash_on_white"
)
img
=
UIImage
(
named
:
"ic_flash_on_white"
)
print
(
"Flash On"
)
captureView
.
captureSession
.
flashMode
=
.
On
print
(
"On"
)
case
.
On
:
case
.
On
:
img
=
UIImage
(
named
:
"ic_flash_auto_white"
)
img
=
UIImage
(
named
:
"ic_flash_auto_white"
)
print
(
"Flash Auto"
)
captureView
.
captureSession
.
flashMode
=
.
Off
print
(
"Auto"
)
case
.
Auto
:
case
.
Auto
:
img
=
UIImage
(
named
:
"ic_flash_off_white"
)
img
=
UIImage
(
named
:
"ic_flash_off_white"
)
print
(
"Flash Off"
)
captureView
.
captureSession
.
flashMode
=
.
On
print
(
"Off"
)
}
}
captureView
.
flashButton
?
.
setImage
(
img
,
forState
:
.
Normal
)
captureView
.
flashButton
?
.
setImage
(
img
,
forState
:
.
Normal
)
captureView
.
flashButton
?
.
setImage
(
img
,
forState
:
.
Highlighted
)
captureView
.
flashButton
?
.
setImage
(
img
,
forState
:
.
Highlighted
)
}
}
...
...
Sources/CaptureView.swift
View file @
60626aba
...
@@ -42,24 +42,6 @@ public class CaptureView : MaterialView, CaptureSessionDelegate, CapturePreviewV
...
@@ -42,24 +42,6 @@ public class CaptureView : MaterialView, CaptureSessionDelegate, CapturePreviewV
if
let
v
:
UIButton
=
captureButton
{
if
let
v
:
UIButton
=
captureButton
{
v
.
removeTarget
(
self
,
action
:
"handleCaptureButton:"
,
forControlEvents
:
.
TouchUpInside
)
v
.
removeTarget
(
self
,
action
:
"handleCaptureButton:"
,
forControlEvents
:
.
TouchUpInside
)
v
.
addTarget
(
self
,
action
:
"handleCaptureButton:"
,
forControlEvents
:
.
TouchUpInside
)
v
.
addTarget
(
self
,
action
:
"handleCaptureButton:"
,
forControlEvents
:
.
TouchUpInside
)
}
else
{
captureButton
?
.
removeFromSuperview
()
captureButton
=
nil
}
}
}
/**
:name: flashButton
*/
public
var
flashButton
:
UIButton
?
{
didSet
{
if
let
v
:
UIButton
=
flashButton
{
v
.
removeTarget
(
self
,
action
:
"handleFlashButton:"
,
forControlEvents
:
.
TouchUpInside
)
v
.
addTarget
(
self
,
action
:
"handleFlashButton:"
,
forControlEvents
:
.
TouchUpInside
)
}
else
{
flashButton
?
.
removeFromSuperview
()
flashButton
=
nil
}
}
}
}
}
}
...
@@ -72,14 +54,16 @@ public class CaptureView : MaterialView, CaptureSessionDelegate, CapturePreviewV
...
@@ -72,14 +54,16 @@ public class CaptureView : MaterialView, CaptureSessionDelegate, CapturePreviewV
if
let
v
:
UIButton
=
switchCamerasButton
{
if
let
v
:
UIButton
=
switchCamerasButton
{
v
.
removeTarget
(
self
,
action
:
"handleSwitchCameraButton:"
,
forControlEvents
:
.
TouchUpInside
)
v
.
removeTarget
(
self
,
action
:
"handleSwitchCameraButton:"
,
forControlEvents
:
.
TouchUpInside
)
v
.
addTarget
(
self
,
action
:
"handleSwitchCameraButton:"
,
forControlEvents
:
.
TouchUpInside
)
v
.
addTarget
(
self
,
action
:
"handleSwitchCameraButton:"
,
forControlEvents
:
.
TouchUpInside
)
}
else
{
switchCamerasButton
?
.
removeFromSuperview
()
switchCamerasButton
=
nil
}
}
}
}
}
}
/**
/**
:name: flashButton
*/
public
var
flashButton
:
UIButton
?
/**
:name: captureSession
:name: captureSession
*/
*/
public
var
captureSession
:
CaptureSession
{
public
var
captureSession
:
CaptureSession
{
...
@@ -182,25 +166,6 @@ public class CaptureView : MaterialView, CaptureSessionDelegate, CapturePreviewV
...
@@ -182,25 +166,6 @@ public class CaptureView : MaterialView, CaptureSessionDelegate, CapturePreviewV
}
}
/**
/**
:name: handleFlashButton
*/
internal
func
handleFlashButton
(
button
:
UIButton
)
{
print
(
captureSession
.
flashMode
==
.
Off
)
switch
captureSession
.
flashMode
{
case
.
Off
:
captureSession
.
flashMode
=
.
On
print
(
"On"
)
case
.
On
:
captureSession
.
flashMode
=
.
Off
print
(
"Auto"
)
case
.
Auto
:
print
(
"Off"
)
captureSession
.
flashMode
=
.
On
}
}
/**
:name: preparePreviewView
:name: preparePreviewView
*/
*/
private
func
preparePreviewView
()
{
private
func
preparePreviewView
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment