美文网首页
OC常用第三方框架使用记录

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

作者: Look2021 | 来源:发表于2018-09-04 16:00 被阅读0次

TZImagePickerController

TZImagePickerController *imagePC = [[TZImagePickerController alloc] initWithMaxImagesCount:1 delegate:nil];
imagePC.modalPresentationStyle = UIModalPresentationFullScreen;
// 是否可以选择视频
imagePC.allowPickingVideo = NO;
// 是否可以裁剪
imagePC.allowCrop = YES;
imagePC.scaleAspectFillCrop = YES;

WeakSelf(weakSelf);
imagePC.didFinishPickingPhotosHandle = ^(NSArray<UIImage *> *photos, NSArray *assets, BOOL isSelectOriginalPhoto) {
    
    [QXWindowHudService showLoadingView];
    [UploadQiNiuService uploadImageArray:@[photos.firstObject] success:^(NSString * _Nonnull urlString) {
        
        [weakSelf User_UpdateFieldsApiWithDict:@{@"avatar" : urlString}];
        
    } failure:^(NSError * _Nonnull error) {
        
    }];
};
[self presentViewController:imagePC animated:YES completion:nil];

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;
[self.view addSubviews:[NSArray arrayWithObjects:self.categoryView, self.listContainerView, nil]];

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

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

- (JXCategoryListContainerView *)listContainerView {
    if (!_listContainerView) {
        _listContainerView = [[JXCategoryListContainerView alloc] initWithType:JXCategoryListContainerType_ScrollView delegate:self];
        self.categoryView.listContainer = _listContainerView;
    }
    return _listContainerView;
}

#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

// 地址选择
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];

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

YYText

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
}()

Masonry

[self.webView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.view);
    }];

TTGTagCollectionView 标签

WMPageController 分页

YTKKeyValueStore 数据存储

IQKeyboardManager 键盘处理器

CWLateralSlide 侧滑抽屉框架

HXPhotoPicker 图片选择器

WZLBadge 添加红点

RKNotificationHub 添加红点

相关文章

网友评论

      本文标题:OC常用第三方框架使用记录

      本文链接:https://www.haomeiwen.com/subject/tfzgwftx.html