添加箭头

This commit is contained in:
2025-11-07 21:37:31 +08:00
parent 50dd53b0c0
commit 96cd32ed99
5 changed files with 100 additions and 23 deletions

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "home_down_arrow.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 852 B

View File

@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "home_up_arrow.png",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 773 B

View File

@@ -29,9 +29,15 @@
@property (nonatomic, strong) UIButton *hotButton;
@property (nonatomic, strong) UIButton *rankButton;
@property (nonatomic, strong) UIImageView *underlineImageView; // 线
///
@property (nonatomic, strong) UIImageView *dragArrowImageView;
//
@property (nonatomic, strong) UIView *containerView;
// HWPanModalContentView `containerView` HWPanModalContainerView
// 访 UIView
// `currentPresentationState` - [UIView currentPresentationState] unrecognized selector
// contentContainerView
@property (nonatomic, strong) UIView *contentContainerView;
@property (nonatomic, strong) UIViewController *currentChild;
@property (nonatomic, strong) HomeHotVC *hotVC;
@property (nonatomic, strong) HomeRankVC *rankVC;
@@ -73,21 +79,14 @@
return _indicator;
}
//- (void)panModalTransitionDidFinish {
// //
// [self.indicator applyPresentationState:self.hw_presentationState];
// //
// //
// if (self.topBar && self.topBar.alpha < 1.0) {
// [UIView animateWithDuration:0.18 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
// self.topBar.alpha = 1.0;
// } completion:nil];
// }
//}
//
- (void)panModalTransitionDidFinish {
[self kb_updateDragArrowForState:self.hw_presentationState];
}
- (void)didChangeTransitionToState:(PresentationState)state {
// //
// [self.indicator applyPresentationState:state];
//
[self kb_updateDragArrowForState:state];
}
- (PanModalHeight)shortFormHeight {
@@ -191,7 +190,9 @@
//
[self.secWhiteContentView addSubview:self.topBar];
[self.secWhiteContentView addSubview:self.containerView];
[self.secWhiteContentView addSubview:self.contentContainerView];
//
[self addSubview:self.dragArrowImageView];
// z
[self.secWhiteContentView insertSubview:self.personImageView belowSubview:self.leftBgImageView];
@@ -238,6 +239,14 @@
make.top.equalTo(self.secWhiteContentView).offset(topPadding);
make.height.mas_equalTo(54);
}];
//
[self.dragArrowImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerX.equalTo(self.topBar);
make.bottom.equalTo(self.topBar.mas_top).offset(-20);
make.width.mas_equalTo(18);
make.height.mas_equalTo(18);
}];
[self.hotButton mas_makeConstraints:^(MASConstraintMaker *make) {
make.centerY.equalTo(self.topBar).offset(3);
@@ -258,7 +267,7 @@
make.width.mas_equalTo(78);
}];
[self.containerView mas_makeConstraints:^(MASConstraintMaker *make) {
[self.contentContainerView mas_makeConstraints:^(MASConstraintMaker *make) {
make.top.equalTo(self.topBar.mas_bottom).offset(8);
make.left.right.equalTo(self.secWhiteContentView).inset(20);
make.bottom.equalTo(self.secWhiteContentView);
@@ -318,10 +327,10 @@
//
// [self addChildViewController:target];
[self.containerView addSubview:target.view];
[self.contentContainerView addSubview:target.view];
[target.view mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.right.equalTo(self.containerView);
make.bottom.equalTo(self.containerView).offset(-KB_TABBAR_HEIGHT);
make.left.top.right.equalTo(self.contentContainerView);
make.bottom.equalTo(self.contentContainerView).offset(-KB_TABBAR_HEIGHT);
}];
// [target didMoveToParentViewController:self];
self.currentChild = target;
@@ -414,11 +423,11 @@
return _topBar;
}
- (UIView *)containerView{
if (!_containerView) {
_containerView = [[UIView alloc] init];
- (UIView *)contentContainerView{
if (!_contentContainerView) {
_contentContainerView = [[UIView alloc] init];
}
return _containerView;
return _contentContainerView;
}
- (UIImageView *)underlineImageView{
@@ -429,6 +438,32 @@
return _underlineImageView;
}
//
- (UIImageView *)dragArrowImageView {
if (!_dragArrowImageView) {
_dragArrowImageView = [[UIImageView alloc] init];
_dragArrowImageView.contentMode = UIViewContentModeScaleAspectFit;
// Short
_dragArrowImageView.image = [UIImage imageNamed:@"home_up_arrow"];
}
return _dragArrowImageView;
}
//
- (void)kb_updateDragArrowForState:(PresentationState)state {
NSString *imgName = (state == PresentationStateMedium) ? @"home_down_arrow" : @"home_up_arrow";
UIImage *img = [UIImage imageNamed:imgName];
if (img && self.dragArrowImageView.image != img) {
//
[UIView transitionWithView:self.dragArrowImageView
duration:0.18
options:UIViewAnimationOptionTransitionCrossDissolve | UIViewAnimationOptionBeginFromCurrentState
animations:^{
self.dragArrowImageView.image = img;
} completion:nil];
}
}
- (UIImageView *)leftBgImageView{
if (!_leftBgImageView) {