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

被折叠的 条评论
为什么被折叠?



