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

JPImageresizerView

录音转文字,去水印用到了镜像
#import "JPImageresizerView.h"

###裁剪图片

JPImageresizerConfigure *configure = [JPImageresizerConfigure defaultConfigureWithImage:self.orginImage make:^(JPImageresizerConfigure *configure) {
    // 到这里已经有了默认参数值,可以在这里另外设置你想要的参数值(使用了链式编程方式)
    configure
    .jp_frameType(JPClassicFrameType)
    .jp_resizeWHScale(1.0)
    .jp_gridCount(2)
    .jp_isShowGridlinesWhenIdle(YES)
    .jp_isShowGridlinesWhenDragging(YES)
    .jp_contentInsets(UIEdgeInsetsMake(kAdaptedFloat(20), kAdaptedFloat(20), kAdaptedFloat(160), kAdaptedFloat(20)));
}];
self.configure = configure;

JPImageresizerView *imageresizerView = [JPImageresizerView imageresizerViewWithConfigure:self.configure imageresizerIsCanRecovery:^(BOOL isCanRecovery) {

} imageresizerIsPrepareToScale:^(BOOL isPrepareToScale) {

}];
self.imageresizerView = imageresizerView;
[self.view addSubview:self.imageresizerView];

###裁剪视频

JPImageresizerConfigure *configure = [JPImageresizerConfigure defaultConfigureWithVideoAsset:urlAsset make:nil fixErrorBlock:nil fixStartBlock:nil fixProgressBlock:nil fixCompleteBlock:nil];

CYLTabBarController

中间加号按钮,使用项目:(黑色提词器,百宝箱)

LEEAlert

pod 'LEEAlert'

// 输入框
// 使用一个变量接收自定义的输入框对象 以便于在其他位置调用

__block UITextField *tf = nil;

[LEEAlert alert].config
.LeeTitle(@"请输入邀请码")
//            .LeeContent(@"内容")
.LeeAddTextField(^(UITextField *textField) {
    // 这里可以进行自定义的设置
    if (@available(iOS 13.0, *)) {
        textField.textColor = [UIColor secondaryLabelColor];
    } else {
        textField.textColor = [UIColor darkGrayColor];
    }
    tf = textField; //赋值
})
.LeeAction(@"确定", ^{

})
.leeShouldActionClickClose(^(NSInteger index){
    // 是否可以关闭回调, 当即将关闭时会被调用 根据返回值决定是否执行关闭处理
    // 这里演示了与输入框非空校验结合的例子
    BOOL result = ![tf.text isEqualToString:@""];
    result = index == 0 ? result : YES;
    return result;
})
.LeeCancelAction(@"取消", nil) // 点击事件的Block如果不需要可以传nil
.LeeShow();

WEAKSELF
        __block UITextField *tf = nil;
        [LEEAlert alert].config
        .LeeTitle(@"新建文件夹")
        .LeeAddTextField(^(UITextField *textField) {
            // 这里可以进行自定义的设置
            textField.textColor = k_Color_333333;
            textField.placeholder = @"请输入文件夹名字";
            textField.jk_maxLength = 12;
            tf = textField; //赋值
        })
        .LeeAddAction(^(LEEAction *action) {
            action.title = @"取消";
            action.titleColor = k_Color_999999;
        })
        .LeeAddAction(^(LEEAction *action) {
            action.title = @"确定";
            action.titleColor = k_Color_themeColor;
        })
        .leeShouldActionClickClose(^(NSInteger index){
            // 是否可以关闭回调, 当即将关闭时会被调用 根据返回值决定是否执行关闭处理
            if (index == 0) {
                return YES;
            }
            
            BOOL result = ![tf.text isEqualToString:@""];
            if (kIsEmpty(tf.text)) {
                [TSWindowHudService showViewWithFailed:@"请输入文件夹名字"];
                return NO;
            }
            
            [weakSelf Jia_Shadow_AddDirectoryApiWithName:tf.text];
            return result;
        })
        .LeeShow();

.LeeAddAction(^(LEEAction *action) {
    action.title = @"确定";
    action.titleColor = k_Color_222222;
})

#####Swift

let alt = LEEAlert.actionsheet()
        let _ = alt
            .config
            .leeAction("0.5倍") { [weak self] in
                self?.beishu = 0.5
                self?.setPlayRate()
            }
            .leeAction("0.75倍") { [weak self] in
                self?.beishu = 0.75
                self?.setPlayRate()
            }
            .leeAction("1倍") { [weak self] in
                self?.beishu = 1.0
                self?.setPlayRate()
            }
            .leeAction("1.25倍") { [weak self] in
                self?.beishu = 1.25
                self?.setPlayRate()
            }
            .leeAction("1.5倍") { [weak self] in
                self?.beishu = 1.5
                self?.setPlayRate()
            }
            .leeAction("2倍") { [weak self] in
                self?.beishu = 2.0
                self?.setPlayRate()
            }
            .leeShow()

#CWCarousel轮播图

#import "CWCarousel.h"
@property (nonatomic, strong) CWCarousel *carousel;
[self.carousel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.view.mas_top).offset(kAdaptedFloat(20));
        make.left.right.equalTo(self.view);
        make.height.mas_equalTo(kAdaptedFloat(400));
    }];
- (CWCarousel *)carousel {
    if (!_carousel) {
        
        CWFlowLayout *flowLayout = [[CWFlowLayout alloc] initWithStyle:CWCarouselStyle_H_2];
        flowLayout.itemSpace_H = 10;

        _carousel = [[CWCarousel alloc] initWithFrame:CGRectZero
                                             delegate:self
                                           datasource:self
                                           flowLayout:flowLayout];
        
        _carousel.autoTimInterval = 2;
        _carousel.endless = NO;
        _carousel.backgroundColor = [UIColor clearColor];
        [_carousel registerViewClass:[MSMaterialCenterCollectionCell class] identifier:[MSMaterialCenterCollectionCell jk_className]];
    }
    return _carousel;
}

#pragma mark ------- CWCarouselDelegate -------

- (NSInteger)numbersForCarousel {
    return self.dataArray.count;
}

- (UICollectionViewCell *)viewForCarousel:(CWCarousel *)carousel indexPath:(NSIndexPath *)indexPath index:(NSInteger)index {
    MSMaterialCenterCollectionCell *cell = [carousel.carouselView dequeueReusableCellWithReuseIdentifier:[MSMaterialCenterCollectionCell jk_className] forIndexPath:indexPath];
    
    UIImage *codeImage = [WSLNativeScanTool createQRCodeImageWithString:[NSString stringWithFormat:@"%@%@", kShareBaseUrlString, MSService.userModel.myInviteCode] andSize:kAdaptedSize(65, 65) andBackColor:[UIColor whiteColor] andFrontColor:[UIColor blackColor] andCenterImage:nil];
    
    cell.codeImageView.image = codeImage;
    
    MaterialListModel *model = self.dataArray[index];
    [cell.backImageView ts_loadUrlString:model.picUrlLt.firstObject];
    
    return cell;
}

- (void)CWCarousel:(CWCarousel *)carousel didSelectedAtIndex:(NSInteger)index {
    NSLog(@"did selected at index %ld", index);
}


- (void)CWCarousel:(CWCarousel *)carousel didStartScrollAtIndex:(NSInteger)index indexPathRow:(NSInteger)indexPathRow {
    
}


- (void)CWCarousel:(CWCarousel *)carousel didEndScrollAtIndex:(NSInteger)index indexPathRow:(NSInteger)indexPathRow {
    self.indexPathRow = indexPathRow;
}

#YYText

####YYLabel

QXSingleYYLabelCell *cell = [QXSingleYYLabelCell cellForTableView:tableView];
UIFont *font = [UIFont systemFontOfSize:kAdaptedFloat(14)];
cell.yyLabel.textColor = k_Color_999999;
cell.yyLabel.font = font;
NSMutableAttributedString *text = [[NSMutableAttributedString alloc] initWithString:@"通过红娘认证,即可获得专属红娘标识"];
NSMutableAttributedString *attachment = nil;
// 嵌入 UIImage
UIImage *image = kImageName(@"blinddate_v_icon");
attachment = [NSMutableAttributedString yy_attachmentStringWithContent:image contentMode:UIViewContentModeCenter attachmentSize:image.size alignToFont:font alignment:YYTextVerticalAlignmentCenter];
[text appendAttributedString:attachment];
[text appendAttributedString:[[NSAttributedString alloc] initWithString:@"以及一个专属群组"]];
cell.yyLabel.attributedText = text;
return cell;

lazy var agreeLoginLabel: YYLabel = {
    let agreeLoginLabel = YYLabel()
    agreeLoginLabel.numberOfLines = 0
    agreeLoginLabel.textColor = UIColor(hex: 0xABABAB)
    
    let str = "登录即表示您同意《嘎嘎靓手机商城隐私政策》及《嘎嘎靓用户协议》"
    agreeLoginLabel.textAlignment = .center
    
    let text = NSMutableAttributedString(string: str)
    
    text.yy_setTextHighlight(NSRange(location: "登录即表示您同意".count, length: "《嘎嘎靓手机商城隐私政策》".count), color: UIColor(hex: 0x4C94F7), backgroundColor: nil, tapAction: { [weak self] (_, _, _, _) in
        UserInfo.share.privateApi()
    })
    
    text.yy_setTextHighlight(NSRange(location: "登录即表示您同意《嘎嘎靓手机商城隐私政策》及".count, length: "《嘎嘎靓用户协议》".count), color: UIColor(hex: 0x4C94F7), backgroundColor: nil, tapAction: { [weak self] (_, _, _, _) in
        let vc = WKWebViewController(urlSting: "\(gagaliangUrl)agreement.html")
        vc.title = "嘎嘎靓用户协议"
        self?.navigationController?.pushViewController(vc, animated: true)
    })
    
    text.yy_setFont(UIFont.systemFont(ofSize: 10)~, range: NSRange(location: 0, length: str.count))
    agreeLoginLabel.attributedText = text
    return agreeLoginLabel
}()
相关推荐
GEEKVIP1 小时前
手机使用技巧:8 个 Android 锁屏移除工具 [解锁 Android]
android·macos·ios·智能手机·电脑·手机·iphone
GEEKVIP1 小时前
如何在 Windows 10 上恢复未保存/删除的 Word 文档
macos·ios·智能手机·电脑·word·笔记本电脑·iphone
奇客软件2 小时前
iPhone使用技巧:如何恢复变砖的 iPhone 或 iPad
数码相机·macos·ios·电脑·笔记本电脑·iphone·ipad
前端张三3 小时前
Mac 电脑pink 后端ip地址进行本地联调
服务器·tcp/ip·macos
缘友一世9 小时前
macos安装mongodb
数据库·mongodb·macos
笑非不退17 小时前
macOS开发环境配置与应用开发
macos
colorknight1 天前
1.2.3 HuggingFists安装说明-MacOS安装
人工智能·低代码·macos·huggingface·数据科学·ai agent
GEEKVIP1 天前
如何修复变砖的手机并恢复丢失的数据
macos·ios·智能手机·word·手机·笔记本电脑·iphone
kuai-1 天前
MacOS配置python环境
开发语言·python·macos
一丝晨光1 天前
继承、Lambda、Objective-C和Swift
开发语言·macos·ios·objective-c·swift·继承·lambda