Skip to content
切换导航条
切换导航条
当前项目
正在载入...
登录
陈高翔
/
DreamSleep-iOS
转到一个项目
切换导航栏
切换导航栏固定状态
项目
群组
代码片段
帮助
项目
活动
版本库
流水线
图表
问题
0
合并请求
0
维基
网络
创建新的问题
作业
提交
问题看板
文件
提交
网络
比较
分支
标签
Commit dc159ebd
由
cgx
编写于
2022-04-23 20:53:52 +0800
浏览文件
选项
浏览文件
标签
下载
电子邮件补丁
差异文件
完善系统拍照及相册
1 个父辈
87ed07c9
隐藏空白字符变更
内嵌
并排
正在显示
10 个修改的文件
包含
149 行增加
和
55 行删除
DreamSleep/DreamSleep.xcodeproj/project.pbxproj
DreamSleep/DreamSleep/Profile/Account/AccountController.m
DreamSleep/DreamSleep/Profile/Account/CloseAlertView.h
DreamSleep/DreamSleep/Profile/Account/DSImagePickerController.h
DreamSleep/DreamSleep/Profile/Account/DSImagePickerController.m
DreamSleep/DreamSleep/Profile/Account/PhotoAlertView.h
DreamSleep/DreamSleep/Profile/Account/PhotoAlertView.m
DreamSleep/DreamSleep/Profile/Account/UserInfoTableView.h
DreamSleep/DreamSleep/Profile/Account/UserInfoView.h
DreamSleep/DreamSleep/Profile/Account/UserInfoView.m
DreamSleep/DreamSleep.xcodeproj/project.pbxproj
查看文件 @
dc159eb
...
@@ -51,7 +51,7 @@
...
@@ -51,7 +51,7 @@
D07A4B2A280EA6B600BA0EC0 /* UserInfoTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07A4B29280EA6B600BA0EC0 /* UserInfoTableView.m */; };
D07A4B2A280EA6B600BA0EC0 /* UserInfoTableView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07A4B29280EA6B600BA0EC0 /* UserInfoTableView.m */; };
D07A4B2D280EA73B00BA0EC0 /* UserInfoView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07A4B2C280EA73B00BA0EC0 /* UserInfoView.m */; };
D07A4B2D280EA73B00BA0EC0 /* UserInfoView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07A4B2C280EA73B00BA0EC0 /* UserInfoView.m */; };
D07DAC8D281048050067A1BF /* PhotoAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07DAC8C281048050067A1BF /* PhotoAlertView.m */; };
D07DAC8D281048050067A1BF /* PhotoAlertView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07DAC8C281048050067A1BF /* PhotoAlertView.m */; };
D07DAC902810546A0067A1BF /*
JWMImagePickerController.m in Sources */ = {isa = PBXBuildFile; fileRef = D07DAC8F2810546A0067A1BF /* JWM
ImagePickerController.m */; };
D07DAC902810546A0067A1BF /*
DSImagePickerController.m in Sources */ = {isa = PBXBuildFile; fileRef = D07DAC8F2810546A0067A1BF /* DS
ImagePickerController.m */; };
D07DACA42810557D0067A1BF /* CGGeometry+RSKImageCropper.m in Sources */ = {isa = PBXBuildFile; fileRef = D07DAC922810557D0067A1BF /* CGGeometry+RSKImageCropper.m */; };
D07DACA42810557D0067A1BF /* CGGeometry+RSKImageCropper.m in Sources */ = {isa = PBXBuildFile; fileRef = D07DAC922810557D0067A1BF /* CGGeometry+RSKImageCropper.m */; };
D07DACA52810557D0067A1BF /* RSKInternalUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = D07DAC932810557D0067A1BF /* RSKInternalUtility.m */; };
D07DACA52810557D0067A1BF /* RSKInternalUtility.m in Sources */ = {isa = PBXBuildFile; fileRef = D07DAC932810557D0067A1BF /* RSKInternalUtility.m */; };
D07DACA62810557D0067A1BF /* RSKTouchView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07DAC942810557D0067A1BF /* RSKTouchView.m */; };
D07DACA62810557D0067A1BF /* RSKTouchView.m in Sources */ = {isa = PBXBuildFile; fileRef = D07DAC942810557D0067A1BF /* RSKTouchView.m */; };
...
@@ -192,8 +192,8 @@
...
@@ -192,8 +192,8 @@
D07A4B2C280EA73B00BA0EC0 /* UserInfoView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UserInfoView.m; sourceTree = "<group>"; };
D07A4B2C280EA73B00BA0EC0 /* UserInfoView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = UserInfoView.m; sourceTree = "<group>"; };
D07DAC8B281048050067A1BF /* PhotoAlertView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PhotoAlertView.h; sourceTree = "<group>"; };
D07DAC8B281048050067A1BF /* PhotoAlertView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PhotoAlertView.h; sourceTree = "<group>"; };
D07DAC8C281048050067A1BF /* PhotoAlertView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PhotoAlertView.m; sourceTree = "<group>"; };
D07DAC8C281048050067A1BF /* PhotoAlertView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = PhotoAlertView.m; sourceTree = "<group>"; };
D07DAC8E2810546A0067A1BF /*
JWMImagePickerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JWM
ImagePickerController.h; sourceTree = "<group>"; };
D07DAC8E2810546A0067A1BF /*
DSImagePickerController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DS
ImagePickerController.h; sourceTree = "<group>"; };
D07DAC8F2810546A0067A1BF /*
JWMImagePickerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = JWM
ImagePickerController.m; sourceTree = "<group>"; };
D07DAC8F2810546A0067A1BF /*
DSImagePickerController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DS
ImagePickerController.m; sourceTree = "<group>"; };
D07DAC922810557D0067A1BF /* CGGeometry+RSKImageCropper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CGGeometry+RSKImageCropper.m"; sourceTree = "<group>"; };
D07DAC922810557D0067A1BF /* CGGeometry+RSKImageCropper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "CGGeometry+RSKImageCropper.m"; sourceTree = "<group>"; };
D07DAC932810557D0067A1BF /* RSKInternalUtility.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RSKInternalUtility.m; sourceTree = "<group>"; };
D07DAC932810557D0067A1BF /* RSKInternalUtility.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RSKInternalUtility.m; sourceTree = "<group>"; };
D07DAC942810557D0067A1BF /* RSKTouchView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RSKTouchView.m; sourceTree = "<group>"; };
D07DAC942810557D0067A1BF /* RSKTouchView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RSKTouchView.m; sourceTree = "<group>"; };
...
@@ -573,18 +573,18 @@
...
@@ -573,18 +573,18 @@
D07A4B2F280EC21B00BA0EC0 /* Account */ = {
D07A4B2F280EC21B00BA0EC0 /* Account */ = {
isa = PBXGroup;
isa = PBXGroup;
children = (
children = (
D07A4B25280E9BAA00BA0EC0 /* AccountController.h */,
D07A4B26280E9BAA00BA0EC0 /* AccountController.m */,
D07DAC8E2810546A0067A1BF /* DSImagePickerController.h */,
D07DAC8F2810546A0067A1BF /* DSImagePickerController.m */,
D07A4B2B280EA73B00BA0EC0 /* UserInfoView.h */,
D07A4B2B280EA73B00BA0EC0 /* UserInfoView.h */,
D07A4B2C280EA73B00BA0EC0 /* UserInfoView.m */,
D07A4B2C280EA73B00BA0EC0 /* UserInfoView.m */,
D07A4B28280EA6B600BA0EC0 /* UserInfoTableView.h */,
D07A4B28280EA6B600BA0EC0 /* UserInfoTableView.h */,
D07A4B29280EA6B600BA0EC0 /* UserInfoTableView.m */,
D07A4B29280EA6B600BA0EC0 /* UserInfoTableView.m */,
D07A4B25280E9BAA00BA0EC0 /* AccountController.h */,
D07A4B26280E9BAA00BA0EC0 /* AccountController.m */,
D053BEE7280F9E310028CCFC /* CloseAlertView.h */,
D053BEE7280F9E310028CCFC /* CloseAlertView.h */,
D053BEE8280F9E310028CCFC /* CloseAlertView.m */,
D053BEE8280F9E310028CCFC /* CloseAlertView.m */,
D07DAC8B281048050067A1BF /* PhotoAlertView.h */,
D07DAC8B281048050067A1BF /* PhotoAlertView.h */,
D07DAC8C281048050067A1BF /* PhotoAlertView.m */,
D07DAC8C281048050067A1BF /* PhotoAlertView.m */,
D07DAC8E2810546A0067A1BF /* JWMImagePickerController.h */,
D07DAC8F2810546A0067A1BF /* JWMImagePickerController.m */,
);
);
path = Account;
path = Account;
sourceTree = "<group>";
sourceTree = "<group>";
...
@@ -1020,7 +1020,7 @@
...
@@ -1020,7 +1020,7 @@
D09D0E9A280D507F008DEDAB /* ProfileAlertView.m in Sources */,
D09D0E9A280D507F008DEDAB /* ProfileAlertView.m in Sources */,
D0506B0C280503A800229278 /* UIButton+Extras.m in Sources */,
D0506B0C280503A800229278 /* UIButton+Extras.m in Sources */,
D0C50B3F27FD381000DC68F0 /* UIView+Extras.m in Sources */,
D0C50B3F27FD381000DC68F0 /* UIView+Extras.m in Sources */,
D07DAC902810546A0067A1BF /*
JWM
ImagePickerController.m in Sources */,
D07DAC902810546A0067A1BF /*
DS
ImagePickerController.m in Sources */,
D0E65FFF2807AC5E006562F2 /* DSProgressHUD.m in Sources */,
D0E65FFF2807AC5E006562F2 /* DSProgressHUD.m in Sources */,
D0E660022807B5AE006562F2 /* SafeSleepRequestModel.m in Sources */,
D0E660022807B5AE006562F2 /* SafeSleepRequestModel.m in Sources */,
D0E6600828080F97006562F2 /* SystemSetController.m in Sources */,
D0E6600828080F97006562F2 /* SystemSetController.m in Sources */,
...
...
DreamSleep/DreamSleep/Profile/Account/AccountController.m
查看文件 @
dc159eb
...
@@ -6,13 +6,13 @@
...
@@ -6,13 +6,13 @@
//
//
#import "AccountController.h"
#import "AccountController.h"
#import "UserInfoView.h"
#import "CloseAlertView.h"
#import "CloseAlertView.h"
#import "UserInfoView.h"
#import "UserRequestModel.h"
#import "UserRequestModel.h"
@interface
AccountController
()
<
UserInfoViewDelegate
,
CloseAlertViewDelegate
>
@interface
AccountController
()
<
UserInfoViewDelegate
,
CloseAlertViewDelegate
>
@property
(
nonatomic
,
strong
)
UserInfoView
*
userInfoView
;
@property
(
nonatomic
,
strong
)
CloseAlertView
*
closeAlertView
;
@property
(
nonatomic
,
strong
)
CloseAlertView
*
closeAlertView
;
@property
(
nonatomic
,
strong
)
UserInfoView
*
userInfoView
;
@end
@end
@implementation
AccountController
@implementation
AccountController
...
...
DreamSleep/DreamSleep/Profile/Account/CloseAlertView.h
查看文件 @
dc159eb
...
@@ -13,6 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -13,6 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
-
(
void
)
didClickCloseUserBtn
;
-
(
void
)
didClickCloseUserBtn
;
@end
@end
/// 注销账号弹框
@interface
CloseAlertView
:
UIView
@interface
CloseAlertView
:
UIView
@property
(
nonatomic
,
weak
)
id
<
CloseAlertViewDelegate
>
delegate
;
@property
(
nonatomic
,
weak
)
id
<
CloseAlertViewDelegate
>
delegate
;
...
...
DreamSleep/DreamSleep/Profile/Account/DSImagePickerController.h
0 → 100644
查看文件 @
dc159eb
#import <UIKit/UIKit.h>
typedef
NS_ENUM
(
NSUInteger
,
ImagePickerStyle
)
{
ImagePickerStyleCamera
,
ImagePickerStylePhotoLibrary
};
@protocol
DSImagePickerControllerDelegate
<
NSObject
>
@optional
-
(
void
)
dsPickerImageFinished
:
(
UIImage
*
)
image
;
@end
/// 系统拍照及相册控制器
@interface
DSImagePickerController
:
UIImagePickerController
@property
(
nonatomic
,
weak
)
id
<
DSImagePickerControllerDelegate
>
dsDelegate
;
/* 初始化方法 */
-
(
instancetype
)
initWithImagePickerStyle
:(
ImagePickerStyle
)
style
delegate
:(
id
<
DSImagePickerControllerDelegate
>
)
delegate
;
@end
DreamSleep/DreamSleep/Profile/Account/DSImagePickerController.m
0 → 100644
查看文件 @
dc159eb
#import "DSImagePickerController.h"
@interface
DSImagePickerController
()
<
UIImagePickerControllerDelegate
,
UINavigationControllerDelegate
>
@end
@implementation
DSImagePickerController
-
(
instancetype
)
initWithImagePickerStyle
:(
ImagePickerStyle
)
style
delegate
:(
id
<
DSImagePickerControllerDelegate
>
)
delegate
{
if
(
self
=
[
super
init
])
{
_dsDelegate
=
delegate
;
self
.
allowsEditing
=
NO
;
self
.
delegate
=
self
;
if
(
style
==
ImagePickerStyleCamera
)
{
self
.
sourceType
=
UIImagePickerControllerSourceTypeCamera
;
}
else
if
(
style
==
ImagePickerStylePhotoLibrary
)
{
self
.
sourceType
=
UIImagePickerControllerSourceTypePhotoLibrary
;
}
}
return
self
;
}
#pragma mark - UINavigationControllerDelegate && 解决UIImagePickerController导航透明问题
-
(
void
)
navigationController
:(
UINavigationController
*
)
navigationController
willShowViewController
:(
UIViewController
*
)
viewController
animated
:(
BOOL
)
animated
{
if
([
navigationController
isKindOfClass
:[
UIImagePickerController
class
]])
{
self
.
navigationBarHidden
=
YES
;
if
(
@available
(
iOS
13
.
0
,
*
))
{
UINavigationBarAppearance
*
appearance
=
[
UINavigationBarAppearance
new
];
// 导航栏背景色
appearance
.
backgroundColor
=
DSBlack
;
// 隐藏分割线
appearance
.
shadowColor
=
DSClearColor
;
// 生效
self
.
navigationBar
.
scrollEdgeAppearance
=
appearance
;
// 滚动视图滚动后导航栏背景色不会被影响
self
.
navigationBar
.
standardAppearance
=
appearance
;
}
}
}
#pragma mark - UIImagePickerControllerDelegate
-
(
void
)
imagePickerController
:(
UIImagePickerController
*
)
picker
didFinishPickingMediaWithInfo
:(
NSDictionary
<
NSString
*
,
id
>
*
)
info
{
UIImage
*
editedImage
=
[
info
objectForKey
:
UIImagePickerControllerOriginalImage
];
[
picker
dismissViewControllerAnimated
:
YES
completion
:
nil
];
if
([
self
.
dsDelegate
respondsToSelector
:
@selector
(
dsPickerImageFinished
:)])
{
[
self
.
dsDelegate
dsPickerImageFinished
:
editedImage
];
}
}
@end
DreamSleep/DreamSleep/Profile/Account/PhotoAlertView.h
查看文件 @
dc159eb
...
@@ -9,10 +9,20 @@
...
@@ -9,10 +9,20 @@
NS_ASSUME_NONNULL_BEGIN
NS_ASSUME_NONNULL_BEGIN
/// 拍照弹框视图
@protocol
PhotoAlertViewDelegate
<
NSObject
>
@optional
/// 点击拍照或者相册
/// @param index 1:拍照,2:相册
-
(
void
)
didSelectWithIndex
:
(
int
)
index
;
@end
/// 拍照、相册弹框
@interface
PhotoAlertView
:
UIView
@interface
PhotoAlertView
:
UIView
-
(
instancetype
)
initWithVC
:(
UIViewController
*
)
vc
;
@property
(
nonatomic
,
weak
)
id
<
PhotoAlertViewDelegate
>
delegate
;
-
(
instancetype
)
initWithDelegate
:(
id
<
PhotoAlertViewDelegate
>
)
delegate
;
-
(
void
)
showPhotoAlertView
;
-
(
void
)
showPhotoAlertView
;
...
...
DreamSleep/DreamSleep/Profile/Account/PhotoAlertView.m
查看文件 @
dc159eb
...
@@ -6,22 +6,17 @@
...
@@ -6,22 +6,17 @@
//
//
#import "PhotoAlertView.h"
#import "PhotoAlertView.h"
#import "JWMImagePickerController.h"
#import "RSKImageCropper.h"
#import <AVFoundation/AVFoundation.h>
#import <AVFoundation/AVFoundation.h>
@interface
PhotoAlertView
()
<
JWMImagePickerDelegate
,
RSKImageCropViewControllerDelegate
>
@interface
PhotoAlertView
()
@property
(
nonatomic
,
strong
)
UIView
*
photoView
;
@property
(
nonatomic
,
strong
)
UIView
*
photoView
;
@property
(
nonatomic
,
strong
)
JWMImagePickerController
*
imgePicker
;
@end
@end
@implementation
PhotoAlertView
{
@implementation
PhotoAlertView
UIViewController
*
_tmpVc
;
}
-
(
instancetype
)
initWith
VC
:
(
UIViewController
*
)
vc
{
-
(
instancetype
)
initWith
Delegate
:(
id
<
PhotoAlertViewDelegate
>
)
delegate
{
if
(
self
=
[
super
initWithFrame
:[
UIScreen
mainScreen
].
bounds
])
{
if
(
self
=
[
super
initWithFrame
:[
UIScreen
mainScreen
].
bounds
])
{
_
tmpVc
=
vc
;
_
delegate
=
delegate
;
self
.
backgroundColor
=
AlertDarkColor
;
self
.
backgroundColor
=
AlertDarkColor
;
self
.
backgroundColor
=
[
self
.
backgroundColor
colorWithAlphaComponent
:
0
.
6
];
self
.
backgroundColor
=
[
self
.
backgroundColor
colorWithAlphaComponent
:
0
.
6
];
...
@@ -81,17 +76,16 @@
...
@@ -81,17 +76,16 @@
[
DSProgressHUD
showDetailInfo
:
@"您的设备无摄像头!"
];
[
DSProgressHUD
showDetailInfo
:
@"您的设备无摄像头!"
];
return
;
return
;
}
}
[
self
presentViewController
:
ImagePickerStyleCamera
];
[
self
didClickPhotoAlertView
:
1
];
}
else
if
(
sender
.
tag
==
2
)
{
// 从相册中选取
}
else
if
(
sender
.
tag
==
2
)
{
// 从相册中选取
[
self
presentViewController
:
ImagePickerStylePhotoLibrary
];
[
self
didClickPhotoAlertView
:
2
];
}
}
}
}
-
(
void
)
presentViewController
:
(
ImagePickerStyle
)
style
{
-
(
void
)
didClickPhotoAlertView
:(
int
)
index
{
self
.
imgePicker
=
[[
JWMImagePickerController
alloc
]
initWithImagePickerStyle
:
style
delegate
:
self
];
if
(
self
.
delegate
&&
[
self
.
delegate
respondsToSelector
:
@selector
(
didSelectWithIndex
:)])
{
self
.
imgePicker
.
JWMdelegate
=
self
;
[
self
.
delegate
didSelectWithIndex
:
index
];
self
.
imgePicker
.
navigationBar
.
barTintColor
=
style
==
ImagePickerStyleCamera
?
DSBlack
:
DSWhite
;
}
[
_tmpVc
presentViewController
:
self
.
imgePicker
animated
:
YES
completion
:
nil
];
}
}
-
(
void
)
tapAction
:(
UITapGestureRecognizer
*
)
gesture
{
-
(
void
)
tapAction
:(
UITapGestureRecognizer
*
)
gesture
{
...
@@ -100,25 +94,6 @@
...
@@ -100,25 +94,6 @@
}
}
}
}
#pragma mark - JWMImagePickerDelegate
-
(
void
)
jwmImagePickerImageFinished
:
(
UIImage
*
)
image
{
// 跳转到头像剪切页面
RSKImageCropViewController
*
imageCropVC
=
[[
RSKImageCropViewController
alloc
]
initWithImage
:
image
cropMode
:
RSKImageCropModeCircle
];
imageCropVC
.
delegate
=
self
;
[
_tmpVc
presentViewController
:
imageCropVC
animated
:
YES
completion
:
nil
];
}
#pragma mark - RSKImageCropViewControllerDelegate
-
(
void
)
imageCropViewControllerDidCancelCrop
:
(
RSKImageCropViewController
*
)
controller
{
[
_tmpVc
dismissViewControllerAnimated
:
YES
completion
:
nil
];
}
-
(
void
)
imageCropViewController
:
(
RSKImageCropViewController
*
)
controller
didCropImage
:
(
UIImage
*
)
croppedImage
usingCropRect
:
(
CGRect
)
cropRect
{
/** 用户头像上传,成功后存入沙盒 */
[
_tmpVc
dismissViewControllerAnimated
:
YES
completion
:
nil
];
}
#pragma mark - public
#pragma mark - public
-
(
void
)
showPhotoAlertView
{
-
(
void
)
showPhotoAlertView
{
[
DSKeyWindow
addSubview
:
self
];
[
DSKeyWindow
addSubview
:
self
];
...
...
DreamSleep/DreamSleep/Profile/Account/UserInfoTableView.h
查看文件 @
dc159eb
...
@@ -13,6 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -13,6 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
-
(
void
)
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
;
-
(
void
)
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
;
@end
@end
/// 昵称、性别、生日用户数据修改view
@interface
UserInfoTableView
:
UITableView
@interface
UserInfoTableView
:
UITableView
@property
(
nonatomic
,
weak
)
id
<
UserInfoTableViewDelegate
>
setDelegate
;
@property
(
nonatomic
,
weak
)
id
<
UserInfoTableViewDelegate
>
setDelegate
;
...
...
DreamSleep/DreamSleep/Profile/Account/UserInfoView.h
查看文件 @
dc159eb
...
@@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
...
@@ -13,7 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
-
(
void
)
didTriggerUserAction
:
(
int
)
index
;
-
(
void
)
didTriggerUserAction
:
(
int
)
index
;
@end
@end
/// 账户与资料view
/// 账户与资料
页面主
view
@interface
UserInfoView
:
UIView
@interface
UserInfoView
:
UIView
@property
(
nonatomic
,
weak
)
id
<
UserInfoViewDelegate
>
delegate
;
@property
(
nonatomic
,
weak
)
id
<
UserInfoViewDelegate
>
delegate
;
...
...
DreamSleep/DreamSleep/Profile/Account/UserInfoView.m
查看文件 @
dc159eb
...
@@ -6,23 +6,23 @@
...
@@ -6,23 +6,23 @@
//
//
#import "UserInfoView.h"
#import "UserInfoView.h"
#import "PhotoAlertView.h"
#import "UserInfoTableView.h"
#import "UserInfoTableView.h"
#import <YYWebImage/YYWebImage.h>
#import <YYWebImage/YYWebImage.h>
#import "PhotoAlertView.h"
#import "DSImagePickerController.h"
#import "RSKImageCropper.h"
@interface
UserInfoView
()
<
UserInfoTableView
Delegate
>
@interface
UserInfoView
()
<
PhotoAlertViewDelegate
,
UserInfoTableViewDelegate
,
DSImagePickerControllerDelegate
,
RSKImageCropViewController
Delegate
>
@property
(
nonatomic
,
strong
)
UIButton
*
portraitBtn
;
@property
(
nonatomic
,
strong
)
UIButton
*
portraitBtn
;
@property
(
nonatomic
,
strong
)
PhotoAlertView
*
photoAlertView
;
@property
(
nonatomic
,
strong
)
UserInfoTableView
*
userInfoTV
;
@property
(
nonatomic
,
strong
)
UserInfoTableView
*
userInfoTV
;
@property
(
nonatomic
,
strong
)
UIButton
*
layoutBtn
;
@property
(
nonatomic
,
strong
)
UIButton
*
layoutBtn
;
@end
@end
@implementation
UserInfoView
{
@implementation
UserInfoView
UIViewController
*
_tmpVC
;
}
-
(
instancetype
)
initWithDelegate
:(
id
<
UserInfoViewDelegate
>
)
delegate
vc
:(
UIViewController
*
)
vc
{
-
(
instancetype
)
initWithDelegate
:(
id
<
UserInfoViewDelegate
>
)
delegate
vc
:(
UIViewController
*
)
vc
{
if
(
self
=
[
super
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
kScreenHeight
-
kTopHeight
(
0
))])
{
if
(
self
=
[
super
initWithFrame
:
CGRectMake
(
0
,
0
,
kScreenWidth
,
kScreenHeight
-
kTopHeight
(
0
))])
{
_tmpVC
=
vc
;
_delegate
=
delegate
;
_delegate
=
delegate
;
[
self
.
portraitBtn
yy_setImageWithURL
:[
NSURL
URLWithString
:
@"https://img2.ydniu.com/sleep_ssmain/face_img/1648892614555_QhXhJX.jpg"
]
forState
:
UIControlStateNormal
placeholder
:
[
UIImage
imageNamed
:
@"portrait"
]];
[
self
.
portraitBtn
yy_setImageWithURL
:[
NSURL
URLWithString
:
@"https://img2.ydniu.com/sleep_ssmain/face_img/1648892614555_QhXhJX.jpg"
]
forState
:
UIControlStateNormal
placeholder
:
[
UIImage
imageNamed
:
@"portrait"
]];
...
@@ -42,7 +42,7 @@
...
@@ -42,7 +42,7 @@
#pragma mark - Actions
#pragma mark - Actions
-
(
void
)
updatePortraitAction
{
-
(
void
)
updatePortraitAction
{
[
[[
PhotoAlertView
alloc
]
initWithVC
:
_tmpVC
]
showPhotoAlertView
];
[
self
.
photoAlertView
showPhotoAlertView
];
}
}
-
(
void
)
layoutAction
{
-
(
void
)
layoutAction
{
...
@@ -51,6 +51,31 @@
...
@@ -51,6 +51,31 @@
}
}
}
}
#pragma mark - PhotoAlertViewDelegate
-
(
void
)
didSelectWithIndex
:
(
int
)
index
{
ImagePickerStyle
style
=
index
==
1
?
ImagePickerStyleCamera
:
ImagePickerStylePhotoLibrary
;
DSImagePickerController
*
imagePicker
=
[[
DSImagePickerController
alloc
]
initWithImagePickerStyle
:
style
delegate
:
self
];
[
self
.
ds_viewController
presentViewController
:
imagePicker
animated
:
YES
completion
:
nil
];
}
#pragma mark - DSImagePickerControllerDelegate
-
(
void
)
dsPickerImageFinished
:
(
UIImage
*
)
image
{
RSKImageCropViewController
*
imageCropVC
=
[[
RSKImageCropViewController
alloc
]
initWithImage
:
image
cropMode
:
RSKImageCropModeCircle
];
imageCropVC
.
delegate
=
self
;
[
self
.
ds_viewController
presentViewController
:
imageCropVC
animated
:
YES
completion
:
nil
];
}
#pragma mark - RSKImageCropViewControllerDelegate
-
(
void
)
imageCropViewControllerDidCancelCrop
:
(
RSKImageCropViewController
*
)
controller
{
[
self
.
ds_viewController
dismissViewControllerAnimated
:
YES
completion
:
nil
];
}
-
(
void
)
imageCropViewController
:
(
RSKImageCropViewController
*
)
controller
didCropImage
:
(
UIImage
*
)
croppedImage
usingCropRect
:
(
CGRect
)
cropRect
{
// 用户头像上传,成功后存入沙盒
[
self
.
portraitBtn
setImage
:
croppedImage
forState
:
UIControlStateNormal
];
[
self
.
ds_viewController
dismissViewControllerAnimated
:
YES
completion
:
nil
];
}
#pragma mark - UserInfoTableViewDelegate
#pragma mark - UserInfoTableViewDelegate
-
(
void
)
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
-
(
void
)
didSelectRowAtIndexPath
:
(
NSIndexPath
*
)
indexPath
{
...
@@ -79,6 +104,13 @@
...
@@ -79,6 +104,13 @@
return
_portraitBtn
;
return
_portraitBtn
;
}
}
-
(
PhotoAlertView
*
)
photoAlertView
{
if
(
!
_photoAlertView
)
{
_photoAlertView
=
[[
PhotoAlertView
alloc
]
initWithDelegate
:
self
];
}
return
_photoAlertView
;
}
-
(
UserInfoTableView
*
)
userInfoTV
{
-
(
UserInfoTableView
*
)
userInfoTV
{
if
(
!
_userInfoTV
)
{
if
(
!
_userInfoTV
)
{
_userInfoTV
=
[[
UserInfoTableView
alloc
]
initWithFrame
:
CGRectMake
(
15
,
CGRectGetMaxY
(
self
.
portraitBtn
.
frame
)
+
60
,
kScreenWidth
-
30
,
150
)
delegate
:
self
];
_userInfoTV
=
[[
UserInfoTableView
alloc
]
initWithFrame
:
CGRectMake
(
15
,
CGRectGetMaxY
(
self
.
portraitBtn
.
frame
)
+
60
,
kScreenWidth
-
30
,
150
)
delegate
:
self
];
...
...
编写
预览
支持
Markdown
格式
附加文件
你添加了
0
人
到此讨论。请谨慎行事。
Finish editing this message first!
Cancel
请
注册
或
登录
后发表评论