Commit 5c41ae80 cgx

细节优化

1 个父辈 52d1f56b
...@@ -32,11 +32,19 @@ ...@@ -32,11 +32,19 @@
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:closeBtn]; self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:closeBtn];
} }
#pragma mark - Actions
- (void)closeUserAction { - (void)closeUserAction {
self.closeAlertView = [[CloseAlertView alloc] initWithDelegate:self]; self.closeAlertView = [[CloseAlertView alloc] initWithDelegate:self];
[self.closeAlertView showCloseUserAlertView]; [self.closeAlertView showCloseUserAlertView];
} }
- (void)clearUserData:(NSString *)alerStr {
// 清除用户信息
[LoginUtils clearUserLoginData];
[DSProgressHUD showToast:alerStr];
[self.navigationController popViewControllerAnimated:YES];
}
#pragma mark - UserInfoViewDelegate #pragma mark - UserInfoViewDelegate
- (void)didTriggerUserAction:(int)index { - (void)didTriggerUserAction:(int)index {
if (index == 1) { // 退出登录 if (index == 1) { // 退出登录
...@@ -67,18 +75,12 @@ ...@@ -67,18 +75,12 @@
}]; }];
} }
- (void)clearUserData:(NSString *)alerStr {
// 清除用户信息
[LoginUtils clearUserLoginData];
[DSProgressHUD showToast:alerStr];
[self.navigationController popViewControllerAnimated:YES];
}
#pragma mark - 品牌模式 #pragma mark - 品牌模式
- (NaviStyle)navigationBarStyle { - (NaviStyle)navigationBarStyle {
return NaviStyleDefault; return NaviStyleDefault;
} }
#pragma mark - lazy
- (UserInfoView *)userInfoView { - (UserInfoView *)userInfoView {
if (!_userInfoView) { if (!_userInfoView) {
_userInfoView = [[UserInfoView alloc] initWithDelegate:self vc:self]; _userInfoView = [[UserInfoView alloc] initWithDelegate:self vc:self];
......
...@@ -29,11 +29,10 @@ ...@@ -29,11 +29,10 @@
return self; return self;
} }
#pragma mark - 解决UIImagePickerController导航透明问题 #pragma mark - UINavigationControllerDelegate && 解决UIImagePickerController导航透明问题
- (void)navigationController:(UINavigationController *)navigationController - (void)navigationController:(UINavigationController *)navigationController
willShowViewController:(UIViewController *)viewController willShowViewController:(UIViewController *)viewController
animated:(BOOL)animated animated:(BOOL)animated {
{
if ([navigationController isKindOfClass:[UIImagePickerController class]]) { if ([navigationController isKindOfClass:[UIImagePickerController class]]) {
self.navigationBarHidden = YES; self.navigationBarHidden = YES;
if (@available(iOS 13.0, *)) { if (@available(iOS 13.0, *)) {
...@@ -50,6 +49,7 @@ ...@@ -50,6 +49,7 @@
} }
} }
#pragma mark - UIImagePickerControllerDelegate
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info { - (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary<NSString *,id> *)info {
UIImage *editedImage = [info objectForKey:UIImagePickerControllerOriginalImage]; UIImage *editedImage = [info objectForKey:UIImagePickerControllerOriginalImage];
[picker dismissViewControllerAnimated:YES completion:nil]; [picker dismissViewControllerAnimated:YES completion:nil];
......
...@@ -65,15 +65,7 @@ ...@@ -65,15 +65,7 @@
return self; return self;
} }
- (UIButton *)btnWithTitle:(NSString *)title index:(int)index superView:(UIView *)sv { #pragma mark - Actions
UIButton *btn = [UIButton dkBtnTitle:title font:BoldFont(15)];
btn.dk_backgroundColorPicker = DKColorPickerWithKey(TabBarBG);
btn.tag = index;
[btn addTarget:self action:@selector(clickAction:) forControlEvents:UIControlEventTouchUpInside];
[sv addSubview:btn];
return btn;
}
- (void)clickAction:(UIButton *)sender { - (void)clickAction:(UIButton *)sender {
[self dismissPhotoAlertView]; [self dismissPhotoAlertView];
...@@ -97,6 +89,7 @@ ...@@ -97,6 +89,7 @@
- (void)presentViewController:(ImagePickerStyle)style { - (void)presentViewController:(ImagePickerStyle)style {
self.imgePicker = [[JWMImagePickerController alloc] initWithImagePickerStyle:style delegate:self]; self.imgePicker = [[JWMImagePickerController alloc] initWithImagePickerStyle:style delegate:self];
self.imgePicker.JWMdelegate = self;
self.imgePicker.navigationBar.barTintColor = style == ImagePickerStyleCamera ? DSBlack : DSWhite; self.imgePicker.navigationBar.barTintColor = style == ImagePickerStyleCamera ? DSBlack : DSWhite;
[_tmpVc presentViewController:self.imgePicker animated:YES completion:nil]; [_tmpVc presentViewController:self.imgePicker animated:YES completion:nil];
} }
...@@ -145,4 +138,14 @@ ...@@ -145,4 +138,14 @@
return _photoView; return _photoView;
} }
#pragma mark - others
- (UIButton *)btnWithTitle:(NSString *)title index:(int)index superView:(UIView *)sv {
UIButton *btn = [UIButton dkBtnTitle:title font:BoldFont(15)];
btn.dk_backgroundColorPicker = DKColorPickerWithKey(TabBarBG);
btn.tag = index;
[btn addTarget:self action:@selector(clickAction:) forControlEvents:UIControlEventTouchUpInside];
[sv addSubview:btn];
return btn;
}
@end @end
...@@ -13,6 +13,7 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -13,6 +13,7 @@ NS_ASSUME_NONNULL_BEGIN
- (void)didTriggerUserAction:(int)index; - (void)didTriggerUserAction:(int)index;
@end @end
/// 账户与资料view
@interface UserInfoView : UIView @interface UserInfoView : UIView
@property (nonatomic, weak) id<UserInfoViewDelegate> delegate; @property (nonatomic, weak) id<UserInfoViewDelegate> delegate;
......
...@@ -30,16 +30,17 @@ ...@@ -30,16 +30,17 @@
[self addSubview:self.userInfoTV]; [self addSubview:self.userInfoTV];
[self addSubview:self.layoutBtn]; [self addSubview:self.layoutBtn];
CGFloat top = iPhone5 ? 50 : 100;
[self.layoutBtn mas_makeConstraints:^(MASConstraintMaker *make) { [self.layoutBtn mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self); make.centerX.equalTo(self);
make.width.equalTo(@(kScreenWidth - 30)); make.size.mas_equalTo(CGSizeMake(kScreenWidth - 30, 40));
make.height.equalTo(@40); make.top.equalTo(self.userInfoTV.mas_bottom).offset(top);
make.top.equalTo(self.userInfoTV.mas_bottom).offset(100);
}]; }];
} }
return self; return self;
} }
#pragma mark - Actions
- (void)updatePortraitAction { - (void)updatePortraitAction {
[[[PhotoAlertView alloc] initWithVC:_tmpVC] showPhotoAlertView]; [[[PhotoAlertView alloc] initWithVC:_tmpVC] showPhotoAlertView];
} }
...@@ -55,9 +56,11 @@ ...@@ -55,9 +56,11 @@
} }
#pragma mark - lazy
- (UIButton *)portraitBtn { - (UIButton *)portraitBtn {
if (!_portraitBtn) { if (!_portraitBtn) {
_portraitBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, 83, 145, 145)]; CGFloat top = iPhone5 ? 40 : 83;
_portraitBtn = [[UIButton alloc] initWithFrame:CGRectMake(0, top, 145, 145)];
_portraitBtn.centerX = self.centerX; _portraitBtn.centerX = self.centerX;
[_portraitBtn addTarget:self action:@selector(updatePortraitAction) forControlEvents:UIControlEventTouchUpInside]; [_portraitBtn addTarget:self action:@selector(updatePortraitAction) forControlEvents:UIControlEventTouchUpInside];
_portraitBtn.imageView.contentMode = UIViewContentModeScaleAspectFit; _portraitBtn.imageView.contentMode = UIViewContentModeScaleAspectFit;
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:shareBtn]; self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:shareBtn];
} }
#pragma mark - Actions
- (void)shareAction { - (void)shareAction {
// 判断是否登录成功 // 判断是否登录成功
if (![LoginUtils getUserLoginData]) { if (![LoginUtils getUserLoginData]) {
...@@ -90,6 +91,7 @@ ...@@ -90,6 +91,7 @@
}]; }];
} }
#pragma mark - lazy
- (UIScrollView *)scrollView { - (UIScrollView *)scrollView {
if (!_scrollView) { if (!_scrollView) {
_scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - kTopHeight(0))]; _scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - kTopHeight(0))];
...@@ -113,4 +115,9 @@ ...@@ -113,4 +115,9 @@
return _animatedView; return _animatedView;
} }
#pragma mark - 品牌模式
- (NaviStyle)navigationBarStyle {
return NaviStyleDefault;
}
@end @end
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!