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
85fcec7c
Commit
85fcec7c
authored
Jan 24, 2017
by
Zhen Tan
Committed by
GitHub
Jan 24, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #328 from Fnoz/master
增加“图片选择页面,可定制 naviBar 的标题、背景色样式”;
parents
6861cf66
1dd299d1
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
113 additions
and
86 deletions
+113
-86
TZImagePickerController/TZImagePickerController/TZAssetCell.m
...agePickerController/TZImagePickerController/TZAssetCell.m
+12
-12
TZImagePickerController/TZImagePickerController/TZGifPhotoPreviewController.m
...ler/TZImagePickerController/TZGifPhotoPreviewController.m
+6
-6
TZImagePickerController/TZImagePickerController/TZImagePickerController.h
...troller/TZImagePickerController/TZImagePickerController.h
+3
-0
TZImagePickerController/TZImagePickerController/TZImagePickerController.m
...troller/TZImagePickerController/TZImagePickerController.m
+42
-18
TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m
...troller/TZImagePickerController/TZPhotoPickerController.m
+22
-22
TZImagePickerController/TZImagePickerController/TZPhotoPreviewController.m
...roller/TZImagePickerController/TZPhotoPreviewController.m
+28
-28
No files found.
TZImagePickerController/TZImagePickerController/TZAssetCell.m
View file @
85fcec7c
...
...
@@ -235,7 +235,7 @@
@interface
TZAlbumCell
()
@property
(
weak
,
nonatomic
)
UIImageView
*
posterImageView
;
@property
(
weak
,
nonatomic
)
UILabel
*
titleLab
le
;
@property
(
weak
,
nonatomic
)
UILabel
*
titleLab
el
;
@property
(
weak
,
nonatomic
)
UIImageView
*
arrowImageView
;
@end
...
...
@@ -247,7 +247,7 @@
NSMutableAttributedString
*
nameString
=
[[
NSMutableAttributedString
alloc
]
initWithString
:
model
.
name
attributes
:@{
NSFontAttributeName
:
[
UIFont
systemFontOfSize
:
16
],
NSForegroundColorAttributeName
:
[
UIColor
blackColor
]}];
NSAttributedString
*
countString
=
[[
NSAttributedString
alloc
]
initWithString
:[
NSString
stringWithFormat
:
@" (%zd)"
,
model
.
count
]
attributes
:@{
NSFontAttributeName
:
[
UIFont
systemFontOfSize
:
16
],
NSForegroundColorAttributeName
:
[
UIColor
lightGrayColor
]}];
[
nameString
appendAttributedString
:
countString
];
self
.
titleLab
le
.
attributedText
=
nameString
;
self
.
titleLab
el
.
attributedText
=
nameString
;
[[
TZImageManager
manager
]
getPostImageWithAlbumModel
:
model
completion
:
^
(
UIImage
*
postImage
)
{
self
.
posterImageView
.
image
=
postImage
;
}];
...
...
@@ -283,17 +283,17 @@
return
_posterImageView
;
}
-
(
UILabel
*
)
titleLab
le
{
if
(
_titleLab
le
==
nil
)
{
UILabel
*
titleLab
le
=
[[
UILabel
alloc
]
init
];
titleLab
le
.
font
=
[
UIFont
boldSystemFontOfSize
:
17
];
titleLab
le
.
frame
=
CGRectMake
(
80
,
0
,
self
.
tz_width
-
80
-
50
,
self
.
tz_height
);
titleLab
le
.
textColor
=
[
UIColor
blackColor
];
titleLab
le
.
textAlignment
=
NSTextAlignmentLeft
;
[
self
.
contentView
addSubview
:
titleLab
le
];
_titleLab
le
=
titleLable
;
-
(
UILabel
*
)
titleLab
el
{
if
(
_titleLab
el
==
nil
)
{
UILabel
*
titleLab
el
=
[[
UILabel
alloc
]
init
];
titleLab
el
.
font
=
[
UIFont
boldSystemFontOfSize
:
17
];
titleLab
el
.
frame
=
CGRectMake
(
80
,
0
,
self
.
tz_width
-
80
-
50
,
self
.
tz_height
);
titleLab
el
.
textColor
=
[
UIColor
blackColor
];
titleLab
el
.
textAlignment
=
NSTextAlignmentLeft
;
[
self
.
contentView
addSubview
:
titleLab
el
];
_titleLab
el
=
titleLabel
;
}
return
_titleLab
le
;
return
_titleLab
el
;
}
-
(
UIImageView
*
)
arrowImageView
{
...
...
TZImagePickerController/TZImagePickerController/TZGifPhotoPreviewController.m
View file @
85fcec7c
...
...
@@ -78,14 +78,14 @@
}
[
_toolBar
addSubview
:
_doneButton
];
UILabel
*
byteLab
le
=
[[
UILabel
alloc
]
init
];
byteLab
le
.
textColor
=
[
UIColor
whiteColor
];
byteLab
le
.
font
=
[
UIFont
systemFontOfSize
:
13
];
byteLab
le
.
frame
=
CGRectMake
(
10
,
0
,
100
,
44
);
UILabel
*
byteLab
el
=
[[
UILabel
alloc
]
init
];
byteLab
el
.
textColor
=
[
UIColor
whiteColor
];
byteLab
el
.
font
=
[
UIFont
systemFontOfSize
:
13
];
byteLab
el
.
frame
=
CGRectMake
(
10
,
0
,
100
,
44
);
[[
TZImageManager
manager
]
getPhotosBytesWithArray
:@[
_model
]
completion
:
^
(
NSString
*
totalBytes
)
{
byteLab
le
.
text
=
totalBytes
;
byteLab
el
.
text
=
totalBytes
;
}];
[
_toolBar
addSubview
:
byteLab
le
];
[
_toolBar
addSubview
:
byteLab
el
];
[
self
.
view
addSubview
:
_toolBar
];
}
...
...
TZImagePickerController/TZImagePickerController/TZImagePickerController.h
View file @
85fcec7c
...
...
@@ -127,6 +127,9 @@
/// Appearance / 外观颜色 + 按钮文字
@property
(
nonatomic
,
strong
)
UIColor
*
oKButtonTitleColorNormal
;
@property
(
nonatomic
,
strong
)
UIColor
*
oKButtonTitleColorDisabled
;
@property
(
nonatomic
,
strong
)
UIColor
*
naviBgColor
;
@property
(
nonatomic
,
strong
)
UIColor
*
naviTitleColor
;
@property
(
nonatomic
,
strong
)
UIFont
*
naviTitleFont
;
@property
(
nonatomic
,
strong
)
UIColor
*
barItemTextColor
;
@property
(
nonatomic
,
strong
)
UIFont
*
barItemTextFont
;
...
...
TZImagePickerController/TZImagePickerController/TZImagePickerController.m
View file @
85fcec7c
...
...
@@ -16,7 +16,7 @@
@interface
TZImagePickerController
()
{
NSTimer
*
_timer
;
UILabel
*
_tipLab
le
;
UILabel
*
_tipLab
el
;
UIButton
*
_settingBtn
;
BOOL
_pushPhotoPickerVc
;
BOOL
_didPushPhotoPickerVc
;
...
...
@@ -24,7 +24,7 @@
UIButton
*
_progressHUD
;
UIView
*
_HUDContainer
;
UIActivityIndicatorView
*
_HUDIndicatorView
;
UILabel
*
_HUDLab
le
;
UILabel
*
_HUDLab
el
;
UIStatusBarStyle
_originStatusBarStyle
;
}
...
...
@@ -56,6 +56,28 @@
}
}
-
(
void
)
setNaviBgColor
:(
UIColor
*
)
naviBgColor
{
_naviBgColor
=
naviBgColor
;
self
.
navigationBar
.
barTintColor
=
naviBgColor
;
}
-
(
void
)
setNaviTitleColor
:(
UIColor
*
)
naviTitleColor
{
_naviTitleColor
=
naviTitleColor
;
[
self
configNaviTitleAppearance
];
}
-
(
void
)
setNaviTitleFont
:(
UIFont
*
)
naviTitleFont
{
_naviTitleFont
=
naviTitleFont
;
[
self
configNaviTitleAppearance
];
}
-
(
void
)
configNaviTitleAppearance
{
NSMutableDictionary
*
textAttrs
=
[
NSMutableDictionary
dictionary
];
textAttrs
[
NSForegroundColorAttributeName
]
=
self
.
naviTitleColor
;
textAttrs
[
NSFontAttributeName
]
=
self
.
naviTitleFont
;
self
.
navigationBar
.
titleTextAttributes
=
textAttrs
;
}
-
(
void
)
setBarItemTextFont
:(
UIFont
*
)
barItemTextFont
{
_barItemTextFont
=
barItemTextFont
;
[
self
configBarButtonItemAppearance
];
...
...
@@ -121,17 +143,17 @@
[
self
configDefaultSetting
];
if
(
!
[[
TZImageManager
manager
]
authorizationStatusAuthorized
])
{
_tipLab
le
=
[[
UILabel
alloc
]
init
];
_tipLab
le
.
frame
=
CGRectMake
(
8
,
120
,
self
.
view
.
tz_width
-
16
,
60
);
_tipLab
le
.
textAlignment
=
NSTextAlignmentCenter
;
_tipLab
le
.
numberOfLines
=
0
;
_tipLab
le
.
font
=
[
UIFont
systemFontOfSize
:
16
];
_tipLab
le
.
textColor
=
[
UIColor
blackColor
];
_tipLab
el
=
[[
UILabel
alloc
]
init
];
_tipLab
el
.
frame
=
CGRectMake
(
8
,
120
,
self
.
view
.
tz_width
-
16
,
60
);
_tipLab
el
.
textAlignment
=
NSTextAlignmentCenter
;
_tipLab
el
.
numberOfLines
=
0
;
_tipLab
el
.
font
=
[
UIFont
systemFontOfSize
:
16
];
_tipLab
el
.
textColor
=
[
UIColor
blackColor
];
NSString
*
appName
=
[[
NSBundle
mainBundle
].
infoDictionary
valueForKey
:
@"CFBundleDisplayName"
];
if
(
!
appName
)
appName
=
[[
NSBundle
mainBundle
].
infoDictionary
valueForKey
:
@"CFBundleName"
];
NSString
*
tipText
=
[
NSString
stringWithFormat
:[
NSBundle
tz_localizedStringForKey
:
@"Allow %@ to access your album in
\"
Settings -> Privacy -> Photos
\"
"
],
appName
];
_tipLab
le
.
text
=
tipText
;
[
self
.
view
addSubview
:
_tipLab
le
];
_tipLab
el
.
text
=
tipText
;
[
self
.
view
addSubview
:
_tipLab
el
];
_settingBtn
=
[
UIButton
buttonWithType
:
UIButtonTypeSystem
];
[
_settingBtn
setTitle
:
self
.
settingBtnTitleStr
forState
:
UIControlStateNormal
];
...
...
@@ -200,6 +222,8 @@
self
.
timeout
=
15
;
self
.
photoWidth
=
828
.
0
;
self
.
photoPreviewMaxWidth
=
600
;
self
.
naviTitleColor
=
[
UIColor
whiteColor
];
self
.
naviTitleFont
=
[
UIFont
systemFontOfSize
:
17
];
self
.
barItemTextFont
=
[
UIFont
systemFontOfSize
:
15
];
self
.
barItemTextColor
=
[
UIColor
whiteColor
];
self
.
allowPreview
=
YES
;
...
...
@@ -229,7 +253,7 @@
-
(
void
)
observeAuthrizationStatusChange
{
if
([[
TZImageManager
manager
]
authorizationStatusAuthorized
])
{
[
_tipLab
le
removeFromSuperview
];
[
_tipLab
el
removeFromSuperview
];
[
_settingBtn
removeFromSuperview
];
[
_timer
invalidate
];
_timer
=
nil
;
...
...
@@ -277,14 +301,14 @@
_HUDIndicatorView
=
[[
UIActivityIndicatorView
alloc
]
initWithActivityIndicatorStyle
:
UIActivityIndicatorViewStyleWhite
];
_HUDIndicatorView
.
frame
=
CGRectMake
(
45
,
15
,
30
,
30
);
_HUDLab
le
=
[[
UILabel
alloc
]
init
];
_HUDLab
le
.
frame
=
CGRectMake
(
0
,
40
,
120
,
50
);
_HUDLab
le
.
textAlignment
=
NSTextAlignmentCenter
;
_HUDLab
le
.
text
=
self
.
processHintStr
;
_HUDLab
le
.
font
=
[
UIFont
systemFontOfSize
:
15
];
_HUDLab
le
.
textColor
=
[
UIColor
whiteColor
];
_HUDLab
el
=
[[
UILabel
alloc
]
init
];
_HUDLab
el
.
frame
=
CGRectMake
(
0
,
40
,
120
,
50
);
_HUDLab
el
.
textAlignment
=
NSTextAlignmentCenter
;
_HUDLab
el
.
text
=
self
.
processHintStr
;
_HUDLab
el
.
font
=
[
UIFont
systemFontOfSize
:
15
];
_HUDLab
el
.
textColor
=
[
UIColor
whiteColor
];
[
_HUDContainer
addSubview
:
_HUDLab
le
];
[
_HUDContainer
addSubview
:
_HUDLab
el
];
[
_HUDContainer
addSubview
:
_HUDIndicatorView
];
[
_progressHUD
addSubview
:
_HUDContainer
];
}
...
...
TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m
View file @
85fcec7c
...
...
@@ -22,9 +22,9 @@
UIButton
*
_previewButton
;
UIButton
*
_doneButton
;
UIImageView
*
_numberImageView
;
UILabel
*
_numberLab
le
;
UILabel
*
_numberLab
el
;
UIButton
*
_originalPhotoButton
;
UILabel
*
_originalPhotoLab
le
;
UILabel
*
_originalPhotoLab
el
;
BOOL
_shouldScrollToBottom
;
BOOL
_showTakePhotoBtn
;
...
...
@@ -218,11 +218,11 @@ static CGSize AssetGridThumbnailSize;
_originalPhotoButton
.
selected
=
_isSelectOriginalPhoto
;
_originalPhotoButton
.
enabled
=
tzImagePickerVc
.
selectedModels
.
count
>
0
;
_originalPhotoLab
le
=
[[
UILabel
alloc
]
init
];
_originalPhotoLab
le
.
frame
=
CGRectMake
(
fullImageWidth
+
46
,
0
,
80
,
50
);
_originalPhotoLab
le
.
textAlignment
=
NSTextAlignmentLeft
;
_originalPhotoLab
le
.
font
=
[
UIFont
systemFontOfSize
:
16
];
_originalPhotoLab
le
.
textColor
=
[
UIColor
blackColor
];
_originalPhotoLab
el
=
[[
UILabel
alloc
]
init
];
_originalPhotoLab
el
.
frame
=
CGRectMake
(
fullImageWidth
+
46
,
0
,
80
,
50
);
_originalPhotoLab
el
.
textAlignment
=
NSTextAlignmentLeft
;
_originalPhotoLab
el
.
font
=
[
UIFont
systemFontOfSize
:
16
];
_originalPhotoLab
el
.
textColor
=
[
UIColor
blackColor
];
if
(
_isSelectOriginalPhoto
)
[
self
getSelectedPhotoBytes
];
}
...
...
@@ -241,14 +241,14 @@ static CGSize AssetGridThumbnailSize;
_numberImageView
.
hidden
=
tzImagePickerVc
.
selectedModels
.
count
<=
0
;
_numberImageView
.
backgroundColor
=
[
UIColor
clearColor
];
_numberLab
le
=
[[
UILabel
alloc
]
init
];
_numberLab
le
.
frame
=
_numberImageView
.
frame
;
_numberLab
le
.
font
=
[
UIFont
systemFontOfSize
:
15
];
_numberLab
le
.
textColor
=
[
UIColor
whiteColor
];
_numberLab
le
.
textAlignment
=
NSTextAlignmentCenter
;
_numberLab
le
.
text
=
[
NSString
stringWithFormat
:
@"%zd"
,
tzImagePickerVc
.
selectedModels
.
count
];
_numberLab
le
.
hidden
=
tzImagePickerVc
.
selectedModels
.
count
<=
0
;
_numberLab
le
.
backgroundColor
=
[
UIColor
clearColor
];
_numberLab
el
=
[[
UILabel
alloc
]
init
];
_numberLab
el
.
frame
=
_numberImageView
.
frame
;
_numberLab
el
.
font
=
[
UIFont
systemFontOfSize
:
15
];
_numberLab
el
.
textColor
=
[
UIColor
whiteColor
];
_numberLab
el
.
textAlignment
=
NSTextAlignmentCenter
;
_numberLab
el
.
text
=
[
NSString
stringWithFormat
:
@"%zd"
,
tzImagePickerVc
.
selectedModels
.
count
];
_numberLab
el
.
hidden
=
tzImagePickerVc
.
selectedModels
.
count
<=
0
;
_numberLab
el
.
backgroundColor
=
[
UIColor
clearColor
];
UIView
*
divide
=
[[
UIView
alloc
]
init
];
CGFloat
rgb2
=
222
/
255
.
0
;
...
...
@@ -259,10 +259,10 @@ static CGSize AssetGridThumbnailSize;
[
bottomToolBar
addSubview
:
_previewButton
];
[
bottomToolBar
addSubview
:
_doneButton
];
[
bottomToolBar
addSubview
:
_numberImageView
];
[
bottomToolBar
addSubview
:
_numberLab
le
];
[
bottomToolBar
addSubview
:
_numberLab
el
];
[
self
.
view
addSubview
:
bottomToolBar
];
[
self
.
view
addSubview
:
_originalPhotoButton
];
[
_originalPhotoButton
addSubview
:
_originalPhotoLab
le
];
[
_originalPhotoButton
addSubview
:
_originalPhotoLab
el
];
}
#pragma mark - Click Event
...
...
@@ -275,7 +275,7 @@ static CGSize AssetGridThumbnailSize;
-
(
void
)
originalPhotoButtonClick
{
_originalPhotoButton
.
selected
=
!
_originalPhotoButton
.
isSelected
;
_isSelectOriginalPhoto
=
_originalPhotoButton
.
isSelected
;
_originalPhotoLab
le
.
hidden
=
!
_originalPhotoButton
.
isSelected
;
_originalPhotoLab
el
.
hidden
=
!
_originalPhotoButton
.
isSelected
;
if
(
_isSelectOriginalPhoto
)
[
self
getSelectedPhotoBytes
];
}
...
...
@@ -505,12 +505,12 @@ static CGSize AssetGridThumbnailSize;
_doneButton
.
enabled
=
tzImagePickerVc
.
selectedModels
.
count
>
0
||
tzImagePickerVc
.
alwaysEnableDoneBtn
;
_numberImageView
.
hidden
=
tzImagePickerVc
.
selectedModels
.
count
<=
0
;
_numberLab
le
.
hidden
=
tzImagePickerVc
.
selectedModels
.
count
<=
0
;
_numberLab
le
.
text
=
[
NSString
stringWithFormat
:
@"%zd"
,
tzImagePickerVc
.
selectedModels
.
count
];
_numberLab
el
.
hidden
=
tzImagePickerVc
.
selectedModels
.
count
<=
0
;
_numberLab
el
.
text
=
[
NSString
stringWithFormat
:
@"%zd"
,
tzImagePickerVc
.
selectedModels
.
count
];
_originalPhotoButton
.
enabled
=
tzImagePickerVc
.
selectedModels
.
count
>
0
;
_originalPhotoButton
.
selected
=
(
_isSelectOriginalPhoto
&&
_originalPhotoButton
.
enabled
);
_originalPhotoLab
le
.
hidden
=
(
!
_originalPhotoButton
.
isSelected
);
_originalPhotoLab
el
.
hidden
=
(
!
_originalPhotoButton
.
isSelected
);
if
(
_isSelectOriginalPhoto
)
[
self
getSelectedPhotoBytes
];
}
...
...
@@ -535,7 +535,7 @@ static CGSize AssetGridThumbnailSize;
-
(
void
)
getSelectedPhotoBytes
{
TZImagePickerController
*
imagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
[[
TZImageManager
manager
]
getPhotosBytesWithArray
:
imagePickerVc
.
selectedModels
completion
:
^
(
NSString
*
totalBytes
)
{
_originalPhotoLab
le
.
text
=
[
NSString
stringWithFormat
:
@"(%@)"
,
totalBytes
];
_originalPhotoLab
el
.
text
=
[
NSString
stringWithFormat
:
@"(%@)"
,
totalBytes
];
}];
}
...
...
TZImagePickerController/TZImagePickerController/TZPhotoPreviewController.m
View file @
85fcec7c
...
...
@@ -26,9 +26,9 @@
UIView
*
_toolBar
;
UIButton
*
_doneButton
;
UIImageView
*
_numberImageView
;
UILabel
*
_numberLab
le
;
UILabel
*
_numberLab
el
;
UIButton
*
_originalPhotoButton
;
UILabel
*
_originalPhotoLab
le
;
UILabel
*
_originalPhotoLab
el
;
}
@property
(
nonatomic
,
assign
)
BOOL
isHideNaviBar
;
@property
(
nonatomic
,
strong
)
UIView
*
cropBgView
;
...
...
@@ -123,12 +123,12 @@
[
_originalPhotoButton
setImage
:[
UIImage
imageNamedFromMyBundle
:
_tzImagePickerVc
.
photoPreviewOriginDefImageName
]
forState
:
UIControlStateNormal
];
[
_originalPhotoButton
setImage
:[
UIImage
imageNamedFromMyBundle
:
_tzImagePickerVc
.
photoOriginSelImageName
]
forState
:
UIControlStateSelected
];
_originalPhotoLab
le
=
[[
UILabel
alloc
]
init
];
_originalPhotoLab
le
.
frame
=
CGRectMake
(
fullImageWidth
+
42
,
0
,
80
,
44
);
_originalPhotoLab
le
.
textAlignment
=
NSTextAlignmentLeft
;
_originalPhotoLab
le
.
font
=
[
UIFont
systemFontOfSize
:
13
];
_originalPhotoLab
le
.
textColor
=
[
UIColor
whiteColor
];
_originalPhotoLab
le
.
backgroundColor
=
[
UIColor
clearColor
];
_originalPhotoLab
el
=
[[
UILabel
alloc
]
init
];
_originalPhotoLab
el
.
frame
=
CGRectMake
(
fullImageWidth
+
42
,
0
,
80
,
44
);
_originalPhotoLab
el
.
textAlignment
=
NSTextAlignmentLeft
;
_originalPhotoLab
el
.
font
=
[
UIFont
systemFontOfSize
:
13
];
_originalPhotoLab
el
.
textColor
=
[
UIColor
whiteColor
];
_originalPhotoLab
el
.
backgroundColor
=
[
UIColor
clearColor
];
if
(
_isSelectOriginalPhoto
)
[
self
showPhotoBytes
];
}
...
...
@@ -144,20 +144,20 @@
_numberImageView
.
frame
=
CGRectMake
(
self
.
view
.
tz_width
-
56
-
28
,
7
,
30
,
30
);
_numberImageView
.
hidden
=
_tzImagePickerVc
.
selectedModels
.
count
<=
0
;
_numberLab
le
=
[[
UILabel
alloc
]
init
];
_numberLab
le
.
frame
=
_numberImageView
.
frame
;
_numberLab
le
.
font
=
[
UIFont
systemFontOfSize
:
15
];
_numberLab
le
.
textColor
=
[
UIColor
whiteColor
];
_numberLab
le
.
textAlignment
=
NSTextAlignmentCenter
;
_numberLab
le
.
text
=
[
NSString
stringWithFormat
:
@"%zd"
,
_tzImagePickerVc
.
selectedModels
.
count
];
_numberLab
le
.
hidden
=
_tzImagePickerVc
.
selectedModels
.
count
<=
0
;
_numberLab
le
.
backgroundColor
=
[
UIColor
clearColor
];
[
_originalPhotoButton
addSubview
:
_originalPhotoLab
le
];
_numberLab
el
=
[[
UILabel
alloc
]
init
];
_numberLab
el
.
frame
=
_numberImageView
.
frame
;
_numberLab
el
.
font
=
[
UIFont
systemFontOfSize
:
15
];
_numberLab
el
.
textColor
=
[
UIColor
whiteColor
];
_numberLab
el
.
textAlignment
=
NSTextAlignmentCenter
;
_numberLab
el
.
text
=
[
NSString
stringWithFormat
:
@"%zd"
,
_tzImagePickerVc
.
selectedModels
.
count
];
_numberLab
el
.
hidden
=
_tzImagePickerVc
.
selectedModels
.
count
<=
0
;
_numberLab
el
.
backgroundColor
=
[
UIColor
clearColor
];
[
_originalPhotoButton
addSubview
:
_originalPhotoLab
el
];
[
_toolBar
addSubview
:
_doneButton
];
[
_toolBar
addSubview
:
_originalPhotoButton
];
[
_toolBar
addSubview
:
_numberImageView
];
[
_toolBar
addSubview
:
_numberLab
le
];
[
_toolBar
addSubview
:
_numberLab
el
];
[
self
.
view
addSubview
:
_toolBar
];
}
...
...
@@ -313,7 +313,7 @@
-
(
void
)
originalPhotoButtonClick
{
_originalPhotoButton
.
selected
=
!
_originalPhotoButton
.
isSelected
;
_isSelectOriginalPhoto
=
_originalPhotoButton
.
isSelected
;
_originalPhotoLab
le
.
hidden
=
!
_originalPhotoButton
.
isSelected
;
_originalPhotoLab
el
.
hidden
=
!
_originalPhotoButton
.
isSelected
;
if
(
_isSelectOriginalPhoto
)
{
[
self
showPhotoBytes
];
if
(
!
_selectButton
.
isSelected
)
{
...
...
@@ -391,12 +391,12 @@
TZImagePickerController
*
_tzImagePickerVc
=
(
TZImagePickerController
*
)
self
.
navigationController
;
TZAssetModel
*
model
=
_models
[
_currentIndex
];
_selectButton
.
selected
=
model
.
isSelected
;
_numberLab
le
.
text
=
[
NSString
stringWithFormat
:
@"%zd"
,
_tzImagePickerVc
.
selectedModels
.
count
];
_numberLab
el
.
text
=
[
NSString
stringWithFormat
:
@"%zd"
,
_tzImagePickerVc
.
selectedModels
.
count
];
_numberImageView
.
hidden
=
(
_tzImagePickerVc
.
selectedModels
.
count
<=
0
||
_isHideNaviBar
||
_isCropImage
);
_numberLab
le
.
hidden
=
(
_tzImagePickerVc
.
selectedModels
.
count
<=
0
||
_isHideNaviBar
||
_isCropImage
);
_numberLab
el
.
hidden
=
(
_tzImagePickerVc
.
selectedModels
.
count
<=
0
||
_isHideNaviBar
||
_isCropImage
);
_originalPhotoButton
.
selected
=
_isSelectOriginalPhoto
;
_originalPhotoLab
le
.
hidden
=
!
_originalPhotoButton
.
isSelected
;
_originalPhotoLab
el
.
hidden
=
!
_originalPhotoButton
.
isSelected
;
if
(
_isSelectOriginalPhoto
)
[
self
showPhotoBytes
];
// If is previewing video, hide original photo button
...
...
@@ -404,10 +404,10 @@
if
(
!
_isHideNaviBar
)
{
if
(
model
.
type
==
TZAssetModelMediaTypeVideo
)
{
_originalPhotoButton
.
hidden
=
YES
;
_originalPhotoLab
le
.
hidden
=
YES
;
_originalPhotoLab
el
.
hidden
=
YES
;
}
else
{
_originalPhotoButton
.
hidden
=
NO
;
if
(
_isSelectOriginalPhoto
)
_originalPhotoLab
le
.
hidden
=
NO
;
if
(
_isSelectOriginalPhoto
)
_originalPhotoLab
el
.
hidden
=
NO
;
}
}
...
...
@@ -415,18 +415,18 @@
_selectButton
.
hidden
=
!
_tzImagePickerVc
.
showSelectBtn
;
// 让宽度/高度小于 最小可选照片尺寸 的图片不能选中
if
(
!
[[
TZImageManager
manager
]
isPhotoSelectableWithAsset
:
model
.
asset
])
{
_numberLab
le
.
hidden
=
YES
;
_numberLab
el
.
hidden
=
YES
;
_numberImageView
.
hidden
=
YES
;
_selectButton
.
hidden
=
YES
;
_originalPhotoButton
.
hidden
=
YES
;
_originalPhotoLab
le
.
hidden
=
YES
;
_originalPhotoLab
el
.
hidden
=
YES
;
_doneButton
.
hidden
=
YES
;
}
}
-
(
void
)
showPhotoBytes
{
[[
TZImageManager
manager
]
getPhotosBytesWithArray
:@[
_models
[
_currentIndex
]]
completion
:
^
(
NSString
*
totalBytes
)
{
_originalPhotoLab
le
.
text
=
[
NSString
stringWithFormat
:
@"(%@)"
,
totalBytes
];
_originalPhotoLab
el
.
text
=
[
NSString
stringWithFormat
:
@"(%@)"
,
totalBytes
];
}];
}
...
...
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