Commit 5c41ae80 cgx

细节优化

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