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
55f0f42c
Commit
55f0f42c
authored
Dec 05, 2016
by
banchichen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
允许更改按钮的文字
parent
3d2d8760
Changes
7
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
80 additions
and
48 deletions
+80
-48
TZImagePickerController/TZImagePickerController/TZImagePickerController.bundle/zh-Hans.lproj/Localizable.strings
...PickerController.bundle/zh-Hans.lproj/Localizable.strings
+0
-0
TZImagePickerController/TZImagePickerController/TZImagePickerController.h
...troller/TZImagePickerController/TZImagePickerController.h
+10
-2
TZImagePickerController/TZImagePickerController/TZImagePickerController.m
...troller/TZImagePickerController/TZImagePickerController.m
+16
-4
TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m
...troller/TZImagePickerController/TZPhotoPickerController.m
+30
-25
TZImagePickerController/TZImagePickerController/TZPhotoPreviewController.m
...roller/TZImagePickerController/TZPhotoPreviewController.m
+16
-14
TZImagePickerController/TZImagePickerController/TZVideoPlayerController.m
...troller/TZImagePickerController/TZVideoPlayerController.m
+4
-2
TZImagePickerController/ViewController.m
TZImagePickerController/ViewController.m
+4
-1
No files found.
TZImagePickerController/TZImagePickerController/TZImagePickerController.bundle/zh-Hans.lproj/Localizable.strings
View file @
55f0f42c
B
"OK" = "确定";
...
...
TZImagePickerController/TZImagePickerController/TZImagePickerController.h
View file @
55f0f42c
...
...
@@ -98,6 +98,7 @@
@property
(
nonatomic
,
assign
)
BOOL
allowCrop
;
///< 允许裁剪,默认为YES,showSelectBtn为NO才生效
@property
(
nonatomic
,
assign
)
CGRect
cropRect
;
///< 裁剪框的尺寸
@property
(
nonatomic
,
copy
)
void
(
^
cropViewSettingBlock
)(
UIView
*
cropView
);
///< 自定义裁剪框的其他属性
@property
(
nonatomic
,
copy
)
void
(
^
cropBgViewSettingBlock
)(
UIView
*
cropBgView
);
///< 自定义裁剪框背景的其他属性
-
(
void
)
showAlertWithTitle
:(
NSString
*
)
title
;
-
(
void
)
showProgressHUD
;
...
...
@@ -112,12 +113,19 @@
@property
(
nonatomic
,
copy
)
NSString
*
photoPreviewOriginDefImageName
;
@property
(
nonatomic
,
copy
)
NSString
*
photoNumberIconImageName
;
/// Appearance / 外观颜色
/// Appearance / 外观颜色
+ 按钮文字
@property
(
nonatomic
,
strong
)
UIColor
*
oKButtonTitleColorNormal
;
@property
(
nonatomic
,
strong
)
UIColor
*
oKButtonTitleColorDisabled
;
@property
(
nonatomic
,
strong
)
UIColor
*
barItemTextColor
;
@property
(
nonatomic
,
strong
)
UIFont
*
barItemTextFont
;
@property
(
nonatomic
,
copy
)
NSString
*
doneBtnTitleStr
;
@property
(
nonatomic
,
copy
)
NSString
*
cancelBtnTitleStr
;
@property
(
nonatomic
,
copy
)
NSString
*
previewBtnTitleStr
;
@property
(
nonatomic
,
copy
)
NSString
*
fullImageBtnTitleStr
;
@property
(
nonatomic
,
copy
)
NSString
*
settingBtnTitleStr
;
@property
(
nonatomic
,
copy
)
NSString
*
processHintStr
;
// The picker should dismiss itself; when it dismissed these handle will be called.
// You can also set autoDismiss to NO, then the picker don't dismiss itself.
// If isOriginalPhoto is YES, user picked the original photo.
...
...
TZImagePickerController/TZImagePickerController/TZImagePickerController.m
View file @
55f0f42c
...
...
@@ -128,6 +128,7 @@
self
.
barItemTextColor
=
[
UIColor
whiteColor
];
self
.
columnNumber
=
columnNumber
;
[
self
configDefaultImageName
];
[
self
configDefaultBtnTitle
];
if
(
!
[[
TZImageManager
manager
]
authorizationStatusAuthorized
])
{
_tipLable
=
[[
UILabel
alloc
]
init
];
...
...
@@ -143,7 +144,7 @@
[
self
.
view
addSubview
:
_tipLable
];
_settingBtn
=
[
UIButton
buttonWithType
:
UIButtonTypeSystem
];
[
_settingBtn
setTitle
:
[
NSBundle
tz_localizedStringForKey
:
@"Setting"
]
forState
:
UIControlStateNormal
];
[
_settingBtn
setTitle
:
self
.
settingBtnTitleStr
forState
:
UIControlStateNormal
];
_settingBtn
.
frame
=
CGRectMake
(
0
,
180
,
self
.
view
.
tz_width
,
44
);
_settingBtn
.
titleLabel
.
font
=
[
UIFont
systemFontOfSize
:
18
];
[
_settingBtn
addTarget
:
self
action
:
@selector
(
settingBtnClick
)
forControlEvents
:
UIControlEventTouchUpInside
];
...
...
@@ -170,6 +171,7 @@
self
.
barItemTextFont
=
[
UIFont
systemFontOfSize
:
15
];
self
.
barItemTextColor
=
[
UIColor
whiteColor
];
[
self
configDefaultImageName
];
[
self
configDefaultBtnTitle
];
previewVc
.
photos
=
[
NSMutableArray
arrayWithArray
:
selectedPhotos
];
previewVc
.
currentIndex
=
index
;
...
...
@@ -194,6 +196,15 @@
self
.
photoOriginSelImageName
=
@"photo_original_sel.png"
;
}
-
(
void
)
configDefaultBtnTitle
{
self
.
doneBtnTitleStr
=
[
NSBundle
tz_localizedStringForKey
:
@"Done"
];
self
.
cancelBtnTitleStr
=
[
NSBundle
tz_localizedStringForKey
:
@"Cancel"
];
self
.
previewBtnTitleStr
=
[
NSBundle
tz_localizedStringForKey
:
@"Preview"
];
self
.
fullImageBtnTitleStr
=
[
NSBundle
tz_localizedStringForKey
:
@"Full image"
];
self
.
settingBtnTitleStr
=
[
NSBundle
tz_localizedStringForKey
:
@"Setting"
];
self
.
processHintStr
=
[
NSBundle
tz_localizedStringForKey
:
@"Processing..."
];
}
-
(
void
)
observeAuthrizationStatusChange
{
if
([[
TZImageManager
manager
]
authorizationStatusAuthorized
])
{
[
_tipLable
removeFromSuperview
];
...
...
@@ -250,7 +261,7 @@
_HUDLable
=
[[
UILabel
alloc
]
init
];
_HUDLable
.
frame
=
CGRectMake
(
0
,
40
,
120
,
50
);
_HUDLable
.
textAlignment
=
NSTextAlignmentCenter
;
_HUDLable
.
text
=
@"正在处理..."
;
_HUDLable
.
text
=
self
.
processHintStr
;
_HUDLable
.
font
=
[
UIFont
systemFontOfSize
:
15
];
_HUDLable
.
textColor
=
[
UIColor
whiteColor
];
...
...
@@ -421,7 +432,8 @@
[
super
viewDidLoad
];
self
.
view
.
backgroundColor
=
[
UIColor
whiteColor
];
self
.
navigationItem
.
title
=
[
NSBundle
tz_localizedStringForKey
:
@"Photos"
];
self
.
navigationItem
.
rightBarButtonItem
=
[[
UIBarButtonItem
alloc
]
initWithTitle
:[
NSBundle
tz_localizedStringForKey
:
@"Cancel"
]
style
:
UIBarButtonItemStylePlain
target
:
self
action
:
@selector
(
cancel
)];
TZImagePickerController
*
imagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
self
.
navigationItem
.
rightBarButtonItem
=
[[
UIBarButtonItem
alloc
]
initWithTitle
:
imagePickerVc
.
cancelBtnTitleStr
style
:
UIBarButtonItemStylePlain
target
:
self
action
:
@selector
(
cancel
)];
[
self
configTableView
];
// 1.6.10 采用微信的方式,只在相册列表页定义backBarButtonItem为返回,其余的顺系统的做法
self
.
navigationItem
.
backBarButtonItem
=
[[
UIBarButtonItem
alloc
]
initWithTitle
:[
NSBundle
tz_localizedStringForKey
:
@"Back"
]
style
:
UIBarButtonItemStylePlain
target
:
nil
action
:
nil
];
...
...
TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m
View file @
55f0f42c
This diff is collapsed.
Click to expand it.
TZImagePickerController/TZImagePickerController/TZPhotoPreviewController.m
View file @
55f0f42c
...
...
@@ -24,7 +24,7 @@
UIButton
*
_selectButton
;
UIView
*
_toolBar
;
UIButton
*
_
ok
Button
;
UIButton
*
_
done
Button
;
UIImageView
*
_numberImageView
;
UILabel
*
_numberLable
;
UIButton
*
_originalPhotoButton
;
...
...
@@ -107,16 +107,15 @@
TZImagePickerController
*
_tzImagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
if
(
_tzImagePickerVc
.
allowPickingOriginalPhoto
)
{
NSString
*
fullImageText
=
[
NSBundle
tz_localizedStringForKey
:
@"Full image"
];
CGFloat
fullImageWidth
=
[
fullImageText
boundingRectWithSize
:
CGSizeMake
(
CGFLOAT_MAX
,
CGFLOAT_MAX
)
options
:
NSStringDrawingUsesFontLeading
attributes
:
@{
NSFontAttributeName
:
[
UIFont
systemFontOfSize
:
13
]}
context
:
nil
].
size
.
width
;
CGFloat
fullImageWidth
=
[
_tzImagePickerVc
.
fullImageBtnTitleStr
boundingRectWithSize
:
CGSizeMake
(
CGFLOAT_MAX
,
CGFLOAT_MAX
)
options
:
NSStringDrawingUsesFontLeading
attributes
:
@{
NSFontAttributeName
:
[
UIFont
systemFontOfSize
:
13
]}
context
:
nil
].
size
.
width
;
_originalPhotoButton
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
_originalPhotoButton
.
frame
=
CGRectMake
(
0
,
0
,
fullImageWidth
+
56
,
44
);
_originalPhotoButton
.
imageEdgeInsets
=
UIEdgeInsetsMake
(
0
,
-
10
,
0
,
0
);
_originalPhotoButton
.
backgroundColor
=
[
UIColor
clearColor
];
[
_originalPhotoButton
addTarget
:
self
action
:
@selector
(
originalPhotoButtonClick
)
forControlEvents
:
UIControlEventTouchUpInside
];
_originalPhotoButton
.
titleLabel
.
font
=
[
UIFont
systemFontOfSize
:
13
];
[
_originalPhotoButton
setTitle
:
fullImageText
forState
:
UIControlStateNormal
];
[
_originalPhotoButton
setTitle
:
fullImageText
forState
:
UIControlStateSelected
];
[
_originalPhotoButton
setTitle
:
_tzImagePickerVc
.
fullImageBtnTitleStr
forState
:
UIControlStateNormal
];
[
_originalPhotoButton
setTitle
:
_tzImagePickerVc
.
fullImageBtnTitleStr
forState
:
UIControlStateSelected
];
[
_originalPhotoButton
setTitleColor
:[
UIColor
lightGrayColor
]
forState
:
UIControlStateNormal
];
[
_originalPhotoButton
setTitleColor
:[
UIColor
whiteColor
]
forState
:
UIControlStateSelected
];
[
_originalPhotoButton
setImage
:[
UIImage
imageNamedFromMyBundle
:
_tzImagePickerVc
.
photoPreviewOriginDefImageName
]
forState
:
UIControlStateNormal
];
...
...
@@ -131,12 +130,12 @@
if
(
_isSelectOriginalPhoto
)
[
self
showPhotoBytes
];
}
_
ok
Button
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
_
ok
Button
.
frame
=
CGRectMake
(
self
.
view
.
tz_width
-
44
-
12
,
0
,
44
,
44
);
_
ok
Button
.
titleLabel
.
font
=
[
UIFont
systemFontOfSize
:
16
];
[
_
ok
Button
addTarget
:
self
action
:
@selector
(
doneButtonClick
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
_
okButton
setTitle
:[
NSBundle
tz_localizedStringForKey
:
@"Done"
]
forState
:
UIControlStateNormal
];
[
_
ok
Button
setTitleColor
:
_tzImagePickerVc
.
oKButtonTitleColorNormal
forState
:
UIControlStateNormal
];
_
done
Button
=
[
UIButton
buttonWithType
:
UIButtonTypeCustom
];
_
done
Button
.
frame
=
CGRectMake
(
self
.
view
.
tz_width
-
44
-
12
,
0
,
44
,
44
);
_
done
Button
.
titleLabel
.
font
=
[
UIFont
systemFontOfSize
:
16
];
[
_
done
Button
addTarget
:
self
action
:
@selector
(
doneButtonClick
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
_
doneButton
setTitle
:
_tzImagePickerVc
.
doneBtnTitleStr
forState
:
UIControlStateNormal
];
[
_
done
Button
setTitleColor
:
_tzImagePickerVc
.
oKButtonTitleColorNormal
forState
:
UIControlStateNormal
];
_numberImageView
=
[[
UIImageView
alloc
]
initWithImage
:[
UIImage
imageNamedFromMyBundle
:
_tzImagePickerVc
.
photoNumberIconImageName
]];
_numberImageView
.
backgroundColor
=
[
UIColor
clearColor
];
...
...
@@ -153,7 +152,7 @@
_numberLable
.
backgroundColor
=
[
UIColor
clearColor
];
[
_originalPhotoButton
addSubview
:
_originalPhotoLable
];
[
_toolBar
addSubview
:
_
ok
Button
];
[
_toolBar
addSubview
:
_
done
Button
];
[
_toolBar
addSubview
:
_originalPhotoButton
];
[
_toolBar
addSubview
:
_numberImageView
];
[
_toolBar
addSubview
:
_numberLable
];
...
...
@@ -189,6 +188,9 @@
_cropBgView
.
alpha
=
0
.
5
;
_cropBgView
.
frame
=
self
.
view
.
bounds
;
[
self
.
view
addSubview
:
_cropBgView
];
if
(
_tzImagePickerVc
.
cropBgViewSettingBlock
)
{
_tzImagePickerVc
.
cropBgViewSettingBlock
(
_cropBgView
);
}
[
TZImageCropManager
overlayClippingWithView
:
_cropBgView
cropRect
:
_tzImagePickerVc
.
cropRect
containerView
:
self
.
view
];
_cropView
=
[
UIView
new
];
...
...
@@ -397,7 +399,7 @@
}
}
_
ok
Button
.
hidden
=
NO
;
_
done
Button
.
hidden
=
NO
;
_selectButton
.
hidden
=
!
_tzImagePickerVc
.
showSelectBtn
;
// 让宽度/高度小于 最小可选照片尺寸 的图片不能选中
if
(
!
[[
TZImageManager
manager
]
isPhotoSelectableWithAsset
:
model
.
asset
])
{
...
...
@@ -406,7 +408,7 @@
_selectButton
.
hidden
=
YES
;
_originalPhotoButton
.
hidden
=
YES
;
_originalPhotoLable
.
hidden
=
YES
;
_
ok
Button
.
hidden
=
YES
;
_
done
Button
.
hidden
=
YES
;
}
}
...
...
TZImagePickerController/TZImagePickerController/TZVideoPlayerController.m
View file @
55f0f42c
...
...
@@ -30,7 +30,8 @@
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
self
.
view
.
backgroundColor
=
[
UIColor
blackColor
];
self
.
navigationItem
.
title
=
[
NSBundle
tz_localizedStringForKey
:
@"Preview"
];
TZImagePickerController
*
tzImagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
self
.
navigationItem
.
title
=
tzImagePickerVc
.
previewBtnTitleStr
;
[
self
configMoviePlayer
];
}
...
...
@@ -84,7 +85,8 @@
_okButton
.
frame
=
CGRectMake
(
self
.
view
.
tz_width
-
44
-
12
,
0
,
44
,
44
);
_okButton
.
titleLabel
.
font
=
[
UIFont
systemFontOfSize
:
16
];
[
_okButton
addTarget
:
self
action
:
@selector
(
okButtonClick
)
forControlEvents
:
UIControlEventTouchUpInside
];
[
_okButton
setTitle
:[
NSBundle
tz_localizedStringForKey
:
@"Done"
]
forState
:
UIControlStateNormal
];
TZImagePickerController
*
tzImagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
[
_okButton
setTitle
:
tzImagePickerVc
.
doneBtnTitleStr
forState
:
UIControlStateNormal
];
TZImagePickerController
*
imagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
[
_okButton
setTitleColor
:
imagePickerVc
.
oKButtonTitleColorNormal
forState
:
UIControlStateNormal
];
...
...
TZImagePickerController/ViewController.m
View file @
55f0f42c
...
...
@@ -69,7 +69,6 @@
_selectedPhotos
=
[
NSMutableArray
array
];
_selectedAssets
=
[
NSMutableArray
array
];
[
self
configCollectionView
];
self
.
maxCountTF
.
text
=
@"1"
;
}
-
(
BOOL
)
prefersStatusBarHidden
{
...
...
@@ -237,6 +236,10 @@
cropView
.
layer
.
borderColor
=
[
UIColor
redColor
].
CGColor
;
cropView
.
layer
.
borderWidth
=
2
.
0
;
}];
/*
[imagePickerVc setCropBgViewSettingBlock:^(UIView *cropBgView) {
cropBgView.alpha = 0.5;
}];*/
#pragma mark - 到这里为止
// You can get the photos by block, the same as by delegate.
...
...
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