Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
D
dz_TZImagePickerController
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
shuijing
dz_TZImagePickerController
Commits
f6ff3f35
Commit
f6ff3f35
authored
Aug 03, 2018
by
yuzheng.tz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
demo页弃用UIActionSheet,升级为UIAlertController
parent
0e3bc8ef
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
13 deletions
+20
-13
TZImagePickerController/ViewController.m
TZImagePickerController/ViewController.m
+20
-13
No files found.
TZImagePickerController/ViewController.m
View file @
f6ff3f35
...
...
@@ -21,7 +21,7 @@
#import "TZAssetCell.h"
#import <MobileCoreServices/MobileCoreServices.h>
@interface
ViewController
()
<
TZImagePickerControllerDelegate
,
UICollectionViewDataSource
,
UICollectionViewDelegate
,
UI
ActionSheetDelegate
,
UI
ImagePickerControllerDelegate
,
UIAlertViewDelegate
,
UINavigationControllerDelegate
>
{
@interface
ViewController
()
<
TZImagePickerControllerDelegate
,
UICollectionViewDataSource
,
UICollectionViewDelegate
,
UIImagePickerControllerDelegate
,
UIAlertViewDelegate
,
UINavigationControllerDelegate
>
{
NSMutableArray
*
_selectedPhotos
;
NSMutableArray
*
_selectedAssets
;
BOOL
_isSelectOriginalPhoto
;
...
...
@@ -170,8 +170,25 @@
}
else
if
(
self
.
showTakeVideoBtnSwitch
.
isOn
)
{
takePhotoTitle
=
@"拍摄"
;
}
UIActionSheet
*
sheet
=
[[
UIActionSheet
alloc
]
initWithTitle
:
nil
delegate
:
self
cancelButtonTitle
:
@"取消"
destructiveButtonTitle
:
nil
otherButtonTitles
:
takePhotoTitle
,
@"去相册选择"
,
nil
];
[
sheet
showInView
:
self
.
view
];
UIAlertController
*
alertVc
=
[
UIAlertController
alertControllerWithTitle
:
nil
message
:
nil
preferredStyle
:
UIAlertControllerStyleActionSheet
];
UIAlertAction
*
takePhotoAction
=
[
UIAlertAction
actionWithTitle
:
takePhotoTitle
style
:
UIAlertActionStyleDefault
handler
:^
(
UIAlertAction
*
_Nonnull
action
)
{
[
self
takePhoto
];
}];
[
alertVc
addAction
:
takePhotoAction
];
UIAlertAction
*
imagePickerAction
=
[
UIAlertAction
actionWithTitle
:
@"去相册选择"
style
:
UIAlertActionStyleDefault
handler
:^
(
UIAlertAction
*
_Nonnull
action
)
{
[
self
pushTZImagePickerController
];
}];
[
alertVc
addAction
:
imagePickerAction
];
UIAlertAction
*
cancelAction
=
[
UIAlertAction
actionWithTitle
:
@"取消"
style
:
UIAlertActionStyleCancel
handler
:
nil
];
[
alertVc
addAction
:
cancelAction
];
UIPopoverPresentationController
*
popover
=
alertVc
.
popoverPresentationController
;
UICollectionViewCell
*
cell
=
[
collectionView
cellForItemAtIndexPath
:
indexPath
];
if
(
popover
)
{
popover
.
sourceView
=
cell
;
popover
.
sourceRect
=
cell
.
bounds
;
popover
.
permittedArrowDirections
=
UIPopoverArrowDirectionAny
;
}
[
self
presentViewController
:
alertVc
animated
:
YES
completion
:
nil
];
}
else
{
[
self
pushTZImagePickerController
];
}
...
...
@@ -523,16 +540,6 @@
}
}
#pragma mark - UIActionSheetDelegate
-
(
void
)
actionSheet
:(
UIActionSheet
*
)
actionSheet
clickedButtonAtIndex
:(
NSInteger
)
buttonIndex
{
if
(
buttonIndex
==
0
)
{
// take photo / 去拍照
[
self
takePhoto
];
}
else
if
(
buttonIndex
==
1
)
{
[
self
pushTZImagePickerController
];
}
}
#pragma mark - UIAlertViewDelegate
-
(
void
)
alertView
:(
UIAlertView
*
)
alertView
clickedButtonAtIndex
:(
NSInteger
)
buttonIndex
{
...
...
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