添加HWPanModal和FLAnimatedImage

This commit is contained in:
2025-11-05 22:04:56 +08:00
parent efdcf60ed1
commit abf32e8457
97 changed files with 10853 additions and 2067 deletions

View File

@@ -0,0 +1,66 @@
//
// KBDirectionIndicatorView.m
// keyBoard
//
// Created by Mac on 2025/11/5.
//
#import "KBDirectionIndicatorView.h"
#import "UIView+HW_Frame.h"
@interface KBDirectionIndicatorView ()
@property (nonatomic, strong) UIView *leftView;
@property (nonatomic, strong) UIView *rightView;
@end
@implementation KBDirectionIndicatorView
- (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:CGRectZero];
if (self) {
self.backgroundColor = UIColor.clearColor;
_leftView = [UIView new];
_rightView = [UIView new];
_leftView.backgroundColor = _rightView.backgroundColor = [UIColor colorWithWhite:0.85 alpha:1];
[self addSubview:_leftView];
[self addSubview:_rightView];
}
return self;
}
- (CGSize)indicatorSize { return CGSizeMake(34, 13); }
- (void)setupSubviews {
CGSize size = [self indicatorSize];
self.hw_size = size;
CGFloat h = 5, c = h/2.0;
_leftView.frame = CGRectMake(0, 0, size.width/2 + c, h);
_rightView.frame = CGRectMake(size.width/2 - c, 0, size.width/2 + c, h);
_leftView.hw_centerY = _rightView.hw_centerY = self.hw_height/2.0;
_leftView.layer.cornerRadius = MIN(_leftView.hw_width, _leftView.hw_height)/2;
_rightView.layer.cornerRadius = MIN(_rightView.hw_width, _rightView.hw_height)/2;
}
// HWIndicatorStateNormal
- (void)didChangeToState:(HWIndicatorState)state {
// no-op
}
- (void)applyPresentationState:(PresentationState)state {
CGFloat angle = (CGFloat)(20.0 * M_PI / 180.0);
void (^animate)(void) = ^{
switch (state) {
case PresentationStateShort: // ()
self.leftView.transform = CGAffineTransformMakeRotation(-angle);
self.rightView.transform = CGAffineTransformMakeRotation(angle);
break;
case PresentationStateLong: // ()
default:
self.leftView.transform = CGAffineTransformMakeRotation(angle);
self.rightView.transform = CGAffineTransformMakeRotation(-angle);
break;
}
};
[UIView animateWithDuration:0.25 delay:0 options:UIViewAnimationOptionBeginFromCurrentState|UIViewAnimationOptionCurveEaseOut animations:animate completion:nil];
}
@end