一些常用iOS第三方框架的用法

本文介绍了iOS开发中常用的几个第三方框架,包括TZImagePickerController图片选择器、IDMPhotoBrowser图片浏览器、SDCycleScrollView首页轮播图组件及MZTimerLabel时间显示Label。这些框架功能丰富,易于集成。

好用的iOS第三方框架很多,在此推荐几个,希望能帮助大家

一.图片选择器 : TZImagePickerController (支持多选,选原图,大图预览等) 

初始化:

TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:9 delegate:self];

[self presentViewController:imagePickerVc animated:YES completion:nil];

代理方法返回选择的image对象数组

- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingPhotos:(NSArray<UIImage *> *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto {
    
    // 使用AFN多图上传
}

 

二.图片浏览器:IDMPhotoBrowser,这个框架基于有名的MWPhotoBrowser,可以自定义样式,底部工具条,添加了类似facebook的上下pop缩小动画,用起来挺爽的

例如在collectionView的点击代理方法中初始化:

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    
    NSArray *photos = [IDMPhoto photosWithURLs:@"图片URL数组"];
    IDMPhotoBrowser *browser = [[IDMPhotoBrowser alloc] initWithPhotos:photos];
// 从第几张图开始显示 [browser setInitialPageIndex:indexPath.item]; // 是否显示个数Label,默认NO browser.displayCounterLabel
= YES;
// 是否显示上传按钮,默认YES browser.displayActionButton
= NO; [self presentViewController:browser animated:YES completion:nil]; }

 

三.SDCycleScrollView (首页轮播图,无限滑动,自定义pageControl等)

初始化:

    SDCycleScrollView *cycleScroll = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, scrollW, scrollH) imageURLStringsGroup:@[轮播图URL数组]];
   
    cycleScroll.currentPageDotColor = [UIColor whiteColor];
    cycleScroll.pageDotColor = [UIColor colorWithRed:49/255.0 green:49/255.0 blue:49/255.0 alpha:1];
    
    [self addSubview:cycleScroll];

 

四.MZTimerLabel (显示时间的Label,可以进行倒计时和秒表操作)

初始化:

   MZTimerLabel *stopTimeLabel = [[MZTimerLabel alloc] init];
    stopTimeLabel.timeLabel.font = [UIFont systemFontOfSize:12];
    stopTimeLabel.timeLabel.textColor = KRedColor;
   // 模式:倒计时或者秒表
    stopTimeLabel.timerType = MZTimerLabelTypeTimer;
    [self addSubview:stopTimeLabel];
   // 时间节点
   [self.stopTimeLabel setCountDownTime:second]; 
   [self.stopTimeLabel start];

转载于:https://www.cnblogs.com/ly0709/p/6089258.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值