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
e0a4eda9
Commit
e0a4eda9
authored
Nov 14, 2017
by
yuzheng.tz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
适配iOS6
parent
9ec606b1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
29 additions
and
7 deletions
+29
-7
TZImagePickerController/TZImagePickerController/TZImagePickerController.h
...troller/TZImagePickerController/TZImagePickerController.h
+1
-0
TZImagePickerController/TZImagePickerController/TZImagePickerController.m
...troller/TZImagePickerController/TZImagePickerController.m
+16
-1
TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m
...troller/TZImagePickerController/TZPhotoPickerController.m
+5
-3
TZImagePickerController/TZImagePickerController/TZPhotoPreviewController.m
...roller/TZImagePickerController/TZPhotoPreviewController.m
+1
-1
TZImagePickerController/ViewController.m
TZImagePickerController/ViewController.m
+6
-2
No files found.
TZImagePickerController/TZImagePickerController/TZImagePickerController.h
View file @
e0a4eda9
...
@@ -233,6 +233,7 @@
...
@@ -233,6 +233,7 @@
@interface
NSString
(
TzExtension
)
@interface
NSString
(
TzExtension
)
-
(
BOOL
)
tz_containsString
:(
NSString
*
)
string
;
-
(
BOOL
)
tz_containsString
:(
NSString
*
)
string
;
-
(
CGSize
)
tz_calculateSizeWithAttributes
:(
NSDictionary
*
)
attributes
maxSize
:(
CGSize
)
maxSize
;
@end
@end
...
...
TZImagePickerController/TZImagePickerController/TZImagePickerController.m
View file @
e0a4eda9
...
@@ -62,7 +62,9 @@
...
@@ -62,7 +62,9 @@
-
(
void
)
setNaviBgColor
:(
UIColor
*
)
naviBgColor
{
-
(
void
)
setNaviBgColor
:(
UIColor
*
)
naviBgColor
{
_naviBgColor
=
naviBgColor
;
_naviBgColor
=
naviBgColor
;
self
.
navigationBar
.
barTintColor
=
naviBgColor
;
if
(
iOS7Later
)
{
self
.
navigationBar
.
barTintColor
=
naviBgColor
;
}
}
}
-
(
void
)
setNaviTitleColor
:(
UIColor
*
)
naviTitleColor
{
-
(
void
)
setNaviTitleColor
:(
UIColor
*
)
naviTitleColor
{
...
@@ -708,6 +710,19 @@
...
@@ -708,6 +710,19 @@
}
}
}
}
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
-
(
CGSize
)
tz_calculateSizeWithAttributes
:(
NSDictionary
*
)
attributes
maxSize
:(
CGSize
)
maxSize
{
CGSize
size
;
if
(
iOS7Later
)
{
size
=
[
self
boundingRectWithSize
:
maxSize
options
:
NSStringDrawingUsesFontLeading
attributes
:
attributes
context
:
nil
].
size
;
}
else
{
size
=
[
self
sizeWithFont
:
attributes
[
NSFontAttributeName
]
constrainedToSize
:
maxSize
];
}
return
size
;
}
#pragma clang diagnostic pop
@end
@end
...
...
TZImagePickerController/TZImagePickerController/TZPhotoPickerController.m
View file @
e0a4eda9
...
@@ -54,7 +54,9 @@ static CGFloat itemMargin = 5;
...
@@ -54,7 +54,9 @@ static CGFloat itemMargin = 5;
_imagePickerVc
=
[[
UIImagePickerController
alloc
]
init
];
_imagePickerVc
=
[[
UIImagePickerController
alloc
]
init
];
_imagePickerVc
.
delegate
=
self
;
_imagePickerVc
.
delegate
=
self
;
// set appearance / 改变相册选择页的导航栏外观
// set appearance / 改变相册选择页的导航栏外观
_imagePickerVc
.
navigationBar
.
barTintColor
=
self
.
navigationController
.
navigationBar
.
barTintColor
;
if
(
iOS7Later
)
{
_imagePickerVc
.
navigationBar
.
barTintColor
=
self
.
navigationController
.
navigationBar
.
barTintColor
;
}
_imagePickerVc
.
navigationBar
.
tintColor
=
self
.
navigationController
.
navigationBar
.
tintColor
;
_imagePickerVc
.
navigationBar
.
tintColor
=
self
.
navigationController
.
navigationBar
.
tintColor
;
UIBarButtonItem
*
tzBarItem
,
*
BarItem
;
UIBarButtonItem
*
tzBarItem
,
*
BarItem
;
if
(
iOS9Later
)
{
if
(
iOS9Later
)
{
...
@@ -294,14 +296,14 @@ static CGFloat itemMargin = 5;
...
@@ -294,14 +296,14 @@ static CGFloat itemMargin = 5;
toolBarTop
=
self
.
view
.
tz_height
-
toolBarHeight
-
navigationHeight
;
toolBarTop
=
self
.
view
.
tz_height
-
toolBarHeight
-
navigationHeight
;
}
}
_bottomToolBar
.
frame
=
CGRectMake
(
0
,
toolBarTop
,
self
.
view
.
tz_width
,
toolBarHeight
);
_bottomToolBar
.
frame
=
CGRectMake
(
0
,
toolBarTop
,
self
.
view
.
tz_width
,
toolBarHeight
);
CGFloat
previewWidth
=
[
tzImagePickerVc
.
previewBtnTitleStr
boundingRectWithSize
:
CGSizeMake
(
CGFLOAT_MAX
,
CGFLOAT_MAX
)
options
:
NSStringDrawingUsesFontLeading
attributes
:
@{
NSFontAttributeName
:
[
UIFont
systemFontOfSize
:
16
]}
context
:
nil
].
size
.
width
+
2
;
CGFloat
previewWidth
=
[
tzImagePickerVc
.
previewBtnTitleStr
tz_calculateSizeWithAttributes
:@{
NSFontAttributeName
:
[
UIFont
systemFontOfSize
:
16
]}
maxSize
:
CGSizeMake
(
CGFLOAT_MAX
,
CGFLOAT_MAX
)]
.
width
+
2
;
if
(
!
tzImagePickerVc
.
allowPreview
)
{
if
(
!
tzImagePickerVc
.
allowPreview
)
{
previewWidth
=
0
.
0
;
previewWidth
=
0
.
0
;
}
}
_previewButton
.
frame
=
CGRectMake
(
10
,
3
,
previewWidth
,
44
);
_previewButton
.
frame
=
CGRectMake
(
10
,
3
,
previewWidth
,
44
);
_previewButton
.
tz_width
=
!
tzImagePickerVc
.
showSelectBtn
?
0
:
previewWidth
;
_previewButton
.
tz_width
=
!
tzImagePickerVc
.
showSelectBtn
?
0
:
previewWidth
;
if
(
tzImagePickerVc
.
allowPickingOriginalPhoto
)
{
if
(
tzImagePickerVc
.
allowPickingOriginalPhoto
)
{
CGFloat
fullImageWidth
=
[
tzImagePickerVc
.
fullImageBtnTitleStr
boundingRectWithSize
:
CGSizeMake
(
CGFLOAT_MAX
,
CGFLOAT_MAX
)
options
:
NSStringDrawingUsesFontLeading
attributes
:
@{
NSFontAttributeName
:
[
UIFont
systemFontOfSize
:
13
]}
context
:
nil
].
size
.
width
;
CGFloat
fullImageWidth
=
[
tzImagePickerVc
.
fullImageBtnTitleStr
tz_calculateSizeWithAttributes
:@{
NSFontAttributeName
:
[
UIFont
systemFontOfSize
:
13
]}
maxSize
:
CGSizeMake
(
CGFLOAT_MAX
,
CGFLOAT_MAX
)]
.
width
;
_originalPhotoButton
.
frame
=
CGRectMake
(
CGRectGetMaxX
(
_previewButton
.
frame
),
0
,
fullImageWidth
+
56
,
50
);
_originalPhotoButton
.
frame
=
CGRectMake
(
CGRectGetMaxX
(
_previewButton
.
frame
),
0
,
fullImageWidth
+
56
,
50
);
_originalPhotoLabel
.
frame
=
CGRectMake
(
fullImageWidth
+
46
,
0
,
80
,
50
);
_originalPhotoLabel
.
frame
=
CGRectMake
(
fullImageWidth
+
46
,
0
,
80
,
50
);
}
}
...
...
TZImagePickerController/TZImagePickerController/TZPhotoPreviewController.m
View file @
e0a4eda9
...
@@ -241,7 +241,7 @@
...
@@ -241,7 +241,7 @@
CGFloat
toolBarTop
=
self
.
view
.
tz_height
-
toolBarHeight
;
CGFloat
toolBarTop
=
self
.
view
.
tz_height
-
toolBarHeight
;
_toolBar
.
frame
=
CGRectMake
(
0
,
toolBarTop
,
self
.
view
.
tz_width
,
toolBarHeight
);
_toolBar
.
frame
=
CGRectMake
(
0
,
toolBarTop
,
self
.
view
.
tz_width
,
toolBarHeight
);
if
(
_tzImagePickerVc
.
allowPickingOriginalPhoto
)
{
if
(
_tzImagePickerVc
.
allowPickingOriginalPhoto
)
{
CGFloat
fullImageWidth
=
[
_tzImagePickerVc
.
fullImageBtnTitleStr
boundingRectWithSize
:
CGSizeMake
(
CGFLOAT_MAX
,
CGFLOAT_MAX
)
options
:
NSStringDrawingUsesFontLeading
attributes
:
@{
NSFontAttributeName
:
[
UIFont
systemFontOfSize
:
13
]}
context
:
nil
].
size
.
width
;
CGFloat
fullImageWidth
=
[
_tzImagePickerVc
.
fullImageBtnTitleStr
tz_calculateSizeWithAttributes
:@{
NSFontAttributeName
:
[
UIFont
systemFontOfSize
:
13
]}
maxSize
:
CGSizeMake
(
CGFLOAT_MAX
,
CGFLOAT_MAX
)]
.
width
;
_originalPhotoButton
.
frame
=
CGRectMake
(
0
,
0
,
fullImageWidth
+
56
,
44
);
_originalPhotoButton
.
frame
=
CGRectMake
(
0
,
0
,
fullImageWidth
+
56
,
44
);
_originalPhotoLabel
.
frame
=
CGRectMake
(
fullImageWidth
+
42
,
0
,
80
,
44
);
_originalPhotoLabel
.
frame
=
CGRectMake
(
fullImageWidth
+
42
,
0
,
80
,
44
);
}
}
...
...
TZImagePickerController/ViewController.m
View file @
e0a4eda9
...
@@ -57,7 +57,9 @@
...
@@ -57,7 +57,9 @@
_imagePickerVc
=
[[
UIImagePickerController
alloc
]
init
];
_imagePickerVc
=
[[
UIImagePickerController
alloc
]
init
];
_imagePickerVc
.
delegate
=
self
;
_imagePickerVc
.
delegate
=
self
;
// set appearance / 改变相册选择页的导航栏外观
// set appearance / 改变相册选择页的导航栏外观
_imagePickerVc
.
navigationBar
.
barTintColor
=
self
.
navigationController
.
navigationBar
.
barTintColor
;
if
(
iOS7Later
)
{
_imagePickerVc
.
navigationBar
.
barTintColor
=
self
.
navigationController
.
navigationBar
.
barTintColor
;
}
_imagePickerVc
.
navigationBar
.
tintColor
=
self
.
navigationController
.
navigationBar
.
tintColor
;
_imagePickerVc
.
navigationBar
.
tintColor
=
self
.
navigationController
.
navigationBar
.
tintColor
;
UIBarButtonItem
*
tzBarItem
,
*
BarItem
;
UIBarButtonItem
*
tzBarItem
,
*
BarItem
;
if
(
iOS9Later
)
{
if
(
iOS9Later
)
{
...
@@ -236,7 +238,9 @@
...
@@ -236,7 +238,9 @@
// 2. Set the appearance
// 2. Set the appearance
// 2. 在这里设置imagePickerVc的外观
// 2. 在这里设置imagePickerVc的外观
// imagePickerVc.navigationBar.barTintColor = [UIColor greenColor];
// if (iOS7Later) {
// imagePickerVc.navigationBar.barTintColor = [UIColor greenColor];
// }
// imagePickerVc.oKButtonTitleColorDisabled = [UIColor lightGrayColor];
// imagePickerVc.oKButtonTitleColorDisabled = [UIColor lightGrayColor];
// imagePickerVc.oKButtonTitleColorNormal = [UIColor greenColor];
// imagePickerVc.oKButtonTitleColorNormal = [UIColor greenColor];
// imagePickerVc.navigationBar.translucent = NO;
// imagePickerVc.navigationBar.translucent = NO;
...
...
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