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

#HBDNavigationBar

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

#TYSnapshotScroll

截图拼图大师用了

YBPopupMenu

拼图大师用了

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];
};
popController.maskAlpha = 0;
popController.presentationStyle = zhPopupSlideStyleFromBottom;
popController.layoutType = zhPopupLayoutTypeBottom;
popController.keyboardChangeFollowed = YES;
#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()
}

#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;
}

ZFPlayer

###普通

@property (nonatomic, strong) UIView *containerView;
@property (nonatomic, strong) ZFPlayerController *player;
@property (nonatomic, strong) ZFCustomControlView *controlView;
- (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;
}

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

@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;
}
@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;
}

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;
    }
}

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];

#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]];    
        }

#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];
}

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);
}];

IQKeyboardManager 键盘处理器

#pragma mark ------- 键盘处理 -------
    IQKeyboardManager *manager = [IQKeyboardManager sharedManager];
    manager.enable = YES;
    manager.shouldResignOnTouchOutside = YES;
    manager.shouldToolbarUsesTextFieldTintColor = YES;
    manager.enableAutoToolbar = NO;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值