当前位置:   article > 正文

OC 常用第三方框架使用记录一_ios jxcategoryindicatorbackgroundview

ios jxcategoryindicatorbackgroundview

#HBDNavigationBar

self.hbd_titleTextAttributes = [NSAttributedString.Key.foregroundColor: UIColor.white, NSAttributedString.Key.font: UIFont.boldSystemFont(ofSize: 19)~]
self.hbd_barStyle = .black
self.hbd_barShadowHidden = true
  • 1
  • 2
  • 3

#TYSnapshotScroll

截图拼图大师用了
  • 1

YBPopupMenu

拼图大师用了

  • 1
  • 2

WechatIMG251.png

zhPopupController

WRNoticeAgreementView *view = [[WRNoticeAgreementView alloc] init];
zhPopupController *popController = [[zhPopupController alloc] initWithView:view size:CGSizeMake(kAdaptedFloat(300), kAdaptedFloat(360))];
popController.presentationStyle = zhPopupSlideStyleFade;
popController.dismissOnMaskTouched = NO;
[popController show];

view.hideViewBlock = ^{
    [popController dismiss];
};
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
popController.maskAlpha = 0;
popController.presentationStyle = zhPopupSlideStyleFromBottom;
popController.layoutType = zhPopupLayoutTypeBottom;
  • 1
  • 2
  • 3
popController.keyboardChangeFollowed = YES;
  • 1
#import <zhPopupController/zhPopupController.h>
let view = DaoChuNormalView.init(frame: CGRect.zero)
let popController = zhPopupController.init(view: view, size: CGSize.init(width: kScreenWidth, height: 142~))
popController.presentationStyle = .fromBottom
popController.layoutType = .bottom
popController.show()

view.selectClickClosure = { indexRow in
    if indexRow == 0 {


    } else {

    }

    popController.dismiss()
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

#SVGAPlayer

#import <SVGAPlayer/SVGA.h>
@property (nonatomic, strong) SVGAPlayer *svgaPlayer;

- (SVGAPlayer *)svgaPlayer {
    if (!_svgaPlayer) {
        _svgaPlayer = [[SVGAPlayer alloc] init];
        _svgaPlayer.loops = 0;
        _svgaPlayer.delegate = self;
        _svgaPlayer.hidden = YES;
    }
    return _svgaPlayer;
}

#pragma mark ------- SVGAPlayerDelegate -------

- (void)playSVGA {
    //先停止动画
    [self.svgaPlayer stopAnimation];
    
    SVGAParser *parser = [[SVGAParser alloc] init];
    
    [parser parseWithNamed:@"voicesign_playvoice" inBundle:[NSBundle mainBundle] completionBlock:^(SVGAVideoEntity * _Nonnull videoItem) {
        if (videoItem != nil) {
            self.svgaPlayer.videoItem = videoItem;
            [self.svgaPlayer startAnimation];
        }
        
    } failureBlock:^(NSError * _Nonnull error) {
        DEBUGLOG(@"%@", error.description);
    }];
}

// 动画结束触发
- (void)svgaPlayerDidFinishedAnimation:(SVGAPlayer *)player {
    self.player.hidden = YES;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36

ZFPlayer

###普通

@property (nonatomic, strong) UIView *containerView;
@property (nonatomic, strong) ZFPlayerController *player;
@property (nonatomic, strong) ZFCustomControlView *controlView;
  • 1
  • 2
  • 3
- (UIView *)containerView {
    if (!_containerView) {
        _containerView = [[UIView alloc] init];
    }
    return _containerView;
}

- (ZFPlayerController *)player {
    if (!_player) {
        
        ZFAVPlayerManager *playerManager = [[ZFAVPlayerManager alloc] init];
        playerManager.scalingMode = ZFPlayerScalingModeNone;
        
        _player = [ZFPlayerController playerWithPlayerManager:playerManager containerView:self.containerView];
        _player.controlView = self.controlView;
        /// 设置退到后台继续播放
        _player.pauseWhenAppResignActive = NO;
        
        WEAKSELF
        /// 播放完成
        _player.playerDidToEnd = ^(id  _Nonnull asset) {
            [weakSelf.player.currentPlayerManager replay];
        };
    }
    return _player;
}

- (ZFCustomControlView *)controlView {
    if (!_controlView) {
        _controlView = [ZFCustomControlView new];
    }
    return _controlView;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33

###仿微信朋友圈视频播放

@property (nonatomic, strong) ZFPlayerController *player;
@property (nonatomic, strong) ZFWeChatControlView *controlView;

- (ZFPlayerController *)player {
    if (!_player) {
        ZFAVPlayerManager *playerManager = [[ZFAVPlayerManager alloc] init];
        playerManager.scalingMode = ZFPlayerScalingModeAspectFill;
        /// player的tag值必须在cell里设置
        _player = [ZFPlayerController playerWithScrollView:self.tableView playerManager:playerManager containerViewTag:kZFPlayerViewTag];
        _player.controlView = self.controlView;
        /// 0.4是消失40%时候
        _player.playerDisapperaPercent = 0.4;
        /// 0.6是出现60%时候
        _player.playerApperaPercent = 0.6;
        /// 移动网络依然自动播放
        _player.WWANAutoPlay = YES;
        /// 续播
        _player.resumePlayRecord = YES;
        /// 禁止掉滑动手势
        _player.disableGestureTypes = ZFPlayerDisableGestureTypesPan;
        /// 竖屏的全屏
        _player.orientationObserver.fullScreenMode = ZFFullScreenModePortrait;
        /// 隐藏全屏的状态栏
        _player.orientationObserver.fullScreenStatusBarHidden = YES;
        _player.orientationObserver.fullScreenStatusBarAnimation = UIStatusBarAnimationNone;

        /// 全屏的填充模式(全屏填充、按视频大小填充)
        _player.orientationObserver.portraitFullScreenMode = ZFPortraitFullScreenModeScaleAspectFit;
        /// 禁用竖屏全屏的手势(点击、拖动手势)
        _player.orientationObserver.disablePortraitGestureTypes = ZFDisablePortraitGestureTypesNone;
    }
    return _player;
}

- (ZFWeChatControlView *)controlView {
    if (!_controlView) {
        _controlView = [ZFWeChatControlView new];
    }
    return _controlView;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
@protocol ZFTableViewCellDelegate <NSObject>

- (void)zf_playTheVideoAtIndexPath:(NSIndexPath *)indexPath;

@end

- (void)setDelegate:(id<ZFTableViewCellDelegate>)delegate withIndexPath:(NSIndexPath *)indexPath;

- (void)setDelegate:(id<ZFTableViewCellDelegate>)delegate withIndexPath:(NSIndexPath *)indexPath {
    self.delegate = delegate;
    self.indexPath = indexPath;
}

#pragma mark ------- ZFTableViewCellDelegate -------

- (void)zf_playTheVideoAtIndexPath:(NSIndexPath *)indexPath {
    [self playTheVideoAtIndexPath:indexPath scrollAnimated:NO];
    [self.player enterPortraitFullScreen:YES animated:YES];
}

/// play the video
- (void)playTheVideoAtIndexPath:(NSIndexPath *)indexPath scrollAnimated:(BOOL)animated {
    QXDynamicListModel *model = self.tableData[indexPath.row];
    if (animated) {
         [self.player playTheIndexPath:indexPath assetURL:[NSURL URLWithString:model.href] scrollPosition:ZFPlayerScrollViewScrollPositionCenteredVertically animated:YES];
     } else {
         [self.player playTheIndexPath:indexPath assetURL:[NSURL URLWithString:model.href]];
     }
    
    [self.controlView showCoverViewWithUrl:model.video_thumb];
    CGSize videoSize = kAdaptedSize(220, 220);
    self.player.currentPlayerManager.presentationSize = videoSize;
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33

JXCategoryView

#import <JXCategoryView.h>
#pragma mark ------- JXCategoryListContentViewDelegate -------

- (UIView *)listView {
    return self.view;
}

@property (nonatomic, strong) JXCategoryTitleView *categoryView; // 分页
@property (nonatomic, strong) JXCategoryIndicatorLineView *indicator;
@property (nonatomic, strong) JXCategoryListContainerView *listContainerView;
@property (nonatomic, strong) JXCategoryIndicatorBackgroundView *backgroundView; // 背景

- (JXCategoryTitleView *)jk_categoryView {
    if (!_jk_categoryView) {
        _jk_categoryView = [[JXCategoryTitleView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
        _jk_categoryView.titles = @[@"直播", @"关注", @"视频", @"附近"];
        _jk_categoryView.averageCellSpacingEnabled = NO;
        _jk_categoryView.titleLabelVerticalOffset = kAdaptedFloat(5);
        _jk_categoryView.cellSpacing = kAdaptedFloat(35);
        _jk_categoryView.cellWidth = kAdaptedFloat(20);
        _jk_categoryView.titleColor = k_Color_TipColor;
        _jk_categoryView.titleSelectedColor = [UIColor blackColor];
        _jk_categoryView.titleFont = kAdaptedFontSize(16);
        _jk_categoryView.titleSelectedFont = kAdaptedFontSize(22);
        _jk_categoryView.contentEdgeInsetLeft = kAdaptedFloat(25);
        _jk_categoryView.indicators = @[self.indicator];
    }
    return _jk_categoryView;
}

- (JXCategoryIndicatorLineView *)indicator {
    if (!_indicator) {
        _indicator = [[JXCategoryIndicatorLineView alloc] init];
        _indicator.indicatorColor = k_Color_themeColor;
        _indicator.indicatorWidth = kAdaptedFloat(21);
        _indicator.verticalMargin = kAdaptedFloat(5);
    }
    return _indicator;
}

- (JXCategoryListContainerView *)jk_listContainerView {
    if (!_jk_listContainerView) {
        _jk_listContainerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self];
        self.jk_categoryView.listContainer = _jk_listContainerView;
    }
    return _jk_listContainerView;
}

- (JXCategoryIndicatorBackgroundView *)backgroundView {
    if (!_backgroundView) {
        _backgroundView = [[JXCategoryIndicatorBackgroundView alloc] init];
        _backgroundView.indicatorColor = [UIColor clearColor];
        _backgroundView.indicatorHeight = kAdaptedFloat(24);
        _backgroundView.indicatorCornerRadius = kAdaptedFloat(24) / 2;
        _backgroundView.borderColor = [UIColor blackColor];
        _backgroundView.borderWidth = 1;
    }
    return _backgroundView;
}

#pragma mark ------- JXCategoryListContainerViewDelegate -------

//返回列表的数量
- (NSInteger)numberOfListsInlistContainerView:(JXCategoryListContainerView *)listContainerView {
    return self.categoryView.titles.count;
}

//根据下标index返回对应遵从`JXCategoryListContentViewDelegate`协议的列表实例
- (id<JXCategoryListContentViewDelegate>)listContainerView:(JXCategoryListContainerView *)listContainerView initListForIndex:(NSInteger)index {
    
    switch (index) {
        case 0:
        {
            QXLiveViewController *vc = [[QXLiveViewController alloc] init];
            vc.interFace = Home_GetHot;
            return vc;
        }
            break;

        default:
        {
            QXLiveViewController *vc = [[QXLiveViewController alloc] init];
            vc.interFace = Home_GetNearby;
            return vc;
        }
            break;
    }
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88

BRPickerView

pod 'BRPickerView'
`

`

// 地址选择
BRAddressPickerView *addressPickerView = [[BRAddressPickerView alloc]init];
addressPickerView.pickerMode = BRAddressPickerModeArea;
addressPickerView.title = @"请选择地区";
addressPickerView.selectValues = [self.getCompleteInfoModel.location componentsSeparatedByString:@"-"];
WeakSelf(weakSelf);
addressPickerView.resultBlock = ^(BRProvinceModel * _Nullable province, BRCityModel * _Nullable city, BRAreaModel * _Nullable area) {
    NSString *locetionString = [NSString stringWithFormat:@"%@-%@-%@", province.name, city.name, area.name];
    DEBUGLOG(@"%@", locetionString);
    [weakSelf User_UpdateFieldsApiWithDict:@{@"location" : locetionString}];
};
[addressPickerView show];

// 日期选择
BRDatePickerView *datePickerView = [[BRDatePickerView alloc] init];
datePickerView.pickerMode = BRDatePickerModeYMD;
datePickerView.title = @"选择年月日";
datePickerView.selectValue = self.getCompleteInfoModel.birthday;
// datePickerView.selectDate = [NSDate br_setYear:1990 month:10 day:1];
datePickerView.minDate = [NSDate br_setYear:1900 month:3 day:12];
datePickerView.maxDate = [NSDate date];
WeakSelf(weakSelf);
datePickerView.resultBlock = ^(NSDate *selectDate, NSString *selectValue) {
    DEBUGLOG(@"选择的值:%@", selectValue);
    [weakSelf User_UpdateFieldsApiWithDict:@{@"birthday" : selectValue}];
};
[datePickerView show];

/// 1.单列字符串选择器(传字符串数组)
BRStringPickerView *stringPickerView = [[BRStringPickerView alloc]init];
stringPickerView.pickerMode = BRStringPickerComponentSingle;
stringPickerView.title = @"学历";
stringPickerView.dataSourceArr = @[@"大专以下", @"大专", @"本科", @"硕士", @"博士", @"博士后"];
stringPickerView.selectIndex = 2;
stringPickerView.resultModelBlock = ^(BRResultModel *resultModel) {
    NSLog(@"选择的值:%@", resultModel.value);
};

[stringPickerView show];
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39

#YYModel

//Model 属性名和 JSON 中的 Key 不相同,需实现的方法
+ (NSDictionary<NSString *,id> *)modelCustomPropertyMapper {
    return @{@"cover_url_large" : @[@"cover_url_large",@"coverUrlLarge"],
             };
}

//容器类属性,需实现的方法
+ (NSDictionary *)modelContainerPropertyGenericClass {
    return @{@"list" : [GHDeviceInfo class]
             };
}

// 模型转字典
NSDictionary *dict = [model yy_modelToJSONObject];

NSMutableArray *temp = [[NSMutableArray alloc] init];
        for (NSDictionary *helpDict in array) {
            [temp addObject:[SJUseForHelp yy_modelWithJSON:helpDict]];    
        }
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19

#CWLateralSlide 侧滑抽屉框架

#import "UIViewController+CWLateralSlide.h"

// 注册手势驱动
WEAKSELF
// 第一个参数为是否开启边缘手势,开启则默认从边缘50距离内有效,第二个block为手势过程中我们希望做的操作
[self cw_registerShowIntractiveWithEdgeGesture:YES transitionDirectionAutoBlock:^(CWDrawerTransitionDirection direction) {
    //NSLog(@"direction = %ld", direction);
    if (direction == CWDrawerTransitionFromLeft) { // 左侧滑出
        [weakSelf myClickMethod];
    }
}];

// 我的
- (void)myClickMethod {
    FTMyListTuController *vc = [[FTMyListTuController alloc] init];
    [self cw_showDefaultDrawerViewController:vc];
}
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17

Masonry

make.centerY.equalTo(self.mas_centerY).multipliedBy(0.8);
//宽大于等于200
make.width.greaterThanOrEqualTo(@200);
//宽小于等于200
make.width.lessThanOrEqualTo(@400)
make.edges.equalTo(view.superview).insets(UIEdgeInsetsMake(20, 20, 20, 20));
[self.normalImageView mas_makeConstraints:^(MASConstraintMaker *make) {
    make.centerX.equalTo(self.view);
    make.top.equalTo(self.view.mas_top).offset(kAdaptedFloat(20));
    make.bottom.equalTo(self.view.mas_safeAreaLayoutGuideBottom).offset(-kAdaptedFloat(160));
    make.width.mas_equalTo(self.normalImageView.mas_height).multipliedBy(imageWidth / imageHeight);
}];
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12

IQKeyboardManager 键盘处理器

#pragma mark ------- 键盘处理 -------
    IQKeyboardManager *manager = [IQKeyboardManager sharedManager];
    manager.enable = YES;
    manager.shouldResignOnTouchOutside = YES;
    manager.shouldToolbarUsesTextFieldTintColor = YES;
    manager.enableAutoToolbar = NO;
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/天景科技苑/article/detail/787406
推荐阅读
相关标签
  

闽ICP备14008679号