Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
galaxy-iOS
Project
Project
Details
Activity
Releases
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
mobile-group
galaxy-iOS
Commits
77419eda
Commit
77419eda
authored
Mar 04, 2024
by
pete谢兆麟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加相机授权 取消事件
parent
ec99bfa8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
1 deletion
+26
-1
YHImagePickerView.swift
...ainApplicantInformation(主申请人信息)/V/YHImagePickerView.swift
+26
-1
No files found.
galaxy/galaxy/Classes/Modules/IntelligentService(服务中心)/ServiceProcess(流程)/MainApplicantInformation(主申请人信息)/V/YHImagePickerView.swift
View file @
77419eda
...
@@ -17,6 +17,7 @@
...
@@ -17,6 +17,7 @@
import
UIKit
import
UIKit
import
Alamofire
import
Alamofire
import
Photos
class
YHImagePickerView
:
UIView
{
class
YHImagePickerView
:
UIView
{
var
backImage
:
((
UIImage
)
->
Void
)?
var
backImage
:
((
UIImage
)
->
Void
)?
...
@@ -164,6 +165,7 @@ class YHImagePickerView: UIView {
...
@@ -164,6 +165,7 @@ class YHImagePickerView: UIView {
}
}
@objc
func
takePhoto
()
{
@objc
func
takePhoto
()
{
guard
getPhotoLibraryAuthorization
()
else
{
return
}
if
UIImagePickerController
.
isSourceTypeAvailable
(
.
camera
){
if
UIImagePickerController
.
isSourceTypeAvailable
(
.
camera
){
//创建图片控制器
//创建图片控制器
let
imagePicker
=
UIImagePickerController
()
let
imagePicker
=
UIImagePickerController
()
...
@@ -183,6 +185,7 @@ class YHImagePickerView: UIView {
...
@@ -183,6 +185,7 @@ class YHImagePickerView: UIView {
}
}
@objc
func
selectPhoto
()
{
@objc
func
selectPhoto
()
{
guard
getPhotoLibraryAuthorization
()
else
{
return
}
if
UIImagePickerController
.
isSourceTypeAvailable
(
.
photoLibrary
){
if
UIImagePickerController
.
isSourceTypeAvailable
(
.
photoLibrary
){
let
imagePicker
=
UIImagePickerController
()
let
imagePicker
=
UIImagePickerController
()
imagePicker
.
delegate
=
self
imagePicker
.
delegate
=
self
...
@@ -192,6 +195,28 @@ class YHImagePickerView: UIView {
...
@@ -192,6 +195,28 @@ class YHImagePickerView: UIView {
UIViewController
.
current
?
.
present
(
imagePicker
,
animated
:
true
)
UIViewController
.
current
?
.
present
(
imagePicker
,
animated
:
true
)
}
}
}
}
private
func
getPhotoLibraryAuthorization
()
->
Bool
{
let
authorizationStatus
=
PHPhotoLibrary
.
authorizationStatus
()
switch
authorizationStatus
{
case
.
authorized
:
print
(
"已经授权"
)
return
true
case
.
notDetermined
:
print
(
"不确定是否授权"
)
// 请求授权
PHPhotoLibrary
.
requestAuthorization
({
(
status
)
in
})
case
.
denied
:
print
(
"拒绝授权"
)
case
.
restricted
:
print
(
"限制授权"
)
break
case
.
limited
:
break
@unknown
default
:
break
}
return
false
}
}
}
extension
YHImagePickerView
:
UIGestureRecognizerDelegate
{
extension
YHImagePickerView
:
UIGestureRecognizerDelegate
{
...
@@ -219,7 +244,7 @@ extension YHImagePickerView: UINavigationControllerDelegate, UIImagePickerContro
...
@@ -219,7 +244,7 @@ extension YHImagePickerView: UINavigationControllerDelegate, UIImagePickerContro
}
}
func
imagePickerControllerDidCancel
(
_
picker
:
UIImagePickerController
)
{
func
imagePickerControllerDidCancel
(
_
picker
:
UIImagePickerController
)
{
picker
.
dismiss
(
animated
:
true
,
completion
:
nil
)
}
}
//原生上传
//原生上传
...
...
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