项目开发常用的第三方使用感受与链接

项目开发常用的第三方使用感受与链接

【1】无限轮播图

GitHub地址: https://github.com/gsdios/SDCycleScrollView
这是我使用过的比较好用的轮播图第三方了,也许你觉得自己封装一个也很简单,你的感觉是对的,如果你有这个能力,也许你就不会看到这篇文章了,☺️☺️。下面给使用方法:

// 加载图片的轮播器
    SDCycleScrollView *cycleScrollView = [SDCycleScrollView cycleScrollViewWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 100) delegate:self placeholderImage:nil];
    NSMutableArray *imageURLs = [NSMutableArray arrayWithObjects:@"http://imgsrc.baidu.com/forum/pic/item/e73649178a82b9013946e4b8738da9773b12ef98.jpg",@"http://imgsrc.baidu.com/forum/pic/item/e73649178a82b9013946e4b8738da9773b12ef98.jpg", nil];
    cycleScrollView.imageURLStringsGroup = imageURLs;
    [self.topView addSubview:cycleScrollView];
}

【2】分段选择控制器

GitHub地址: https://github.com/HeshamMegid/HMSegmentedControl 这个在使用的过程中有时候会出现不能滑动的bug,有可能是frame设置的有问题,暂时还没有排查,有时间再排查项目赶得紧,排查出来问题,会更新的,谢谢大家的支持!下面给出经常使用的一些功能方法:

/*
  HMSegmentedControl * segment = [[HMSegmentedControl alloc]initWithSectionTitles:@[@"全部",@"待付款",@"待收货",@"待发货",@"待评价",@"已完成"]];
  segment.frame = bgView.frame;
  segment.selectionIndicatorLocation = HMSegmentedControlSelectionIndicatorLocationDown;
  segment.selectionStyle = HMSegmentedControlSelectionStyleFullWidthStripe;
  segment.selectionIndicatorColor = [UIColor colorWithHexString:@"4d2e8c"];
  segment.selectionIndicatorHeight = 2.f;
  //修改title字体大小和颜色
  segment.selectedTitleTextAttributes = @{NSForegroundColorAttributeName : [UIColor colorWithHexString:@"4d2e8c"],NSFontAttributeName:[UIFont systemFontOfSize:14]};
  segment.titleTextAttributes = @{NSForegroundColorAttributeName : [UIColor colorWithHexString:@"000000"],NSFontAttributeName:[UIFont systemFontOfSize:14]};
  //设置默认选中
  segment.selectedSegmentIndex = self.selectedSegmentIndex;
  //设置点击事件
  segment.indexChangeBlock = ^(NSInteger index){
    };

【3】tableView自动计算cell高度

GitHub地址: https://github.com/forkingdog/UITableView-FDTemplateLayoutCell
这个只适应于tableView的cell高度自适应,也能适用于xib自定义的cell,不适用于collectionView,其他的说明就暂时不写了,GitHub上都有哦!


【4】数据解析类

GitHub地址: https://github.com/CoderMJLee/MJExtension 原文链接放这里了,网上关于这个的说明太多,我也就不多说了,很好用,绝对无污染。


【5】下拉刷新

GitHub地址:https://github.com/CoderMJLee/MJRefresh 从我入行就一直使用的这个下拉刷新,非常好用,讲解就不说了。但是,在这里提醒新手,当你使用的时候一定要注意结束刷新,如果在使用的过程出现中刷新的头部不能隐藏的bug,那就要注意你是否提前结束了刷新动作。


【6】 图片缓存

GitHub地址:https://github.com/rs/SDWebImage 这个开源框架也很早了,但是依然被广大开发者所青睐,使用很方便也很简单,做我们这行的应该没有不知道这个框架的,老掉牙了,在这里也不说了。地址在此,有问题想看原文请阅读readme文档,谢谢!


【7】 键盘管理工具

GitHub地址:https://github.com/hackiftekhar/IQKeyboardManager这个第三方使用起来非常方便,只要打开这几个属性就可以代码如下:

//建议在入库类先关闭键盘自动管理(在哪些页面需要使用在哪些页面打开),因为有些页面如果不是一个整体放在scrollView上那么导航会被推上去,不显示。
[IQKeyboardManager sharedManager].enable = NO;
[IQKeyboardManager sharedManager].enableAutoToolbar = NO;
[IQKeyboardManager sharedManager].shouldResignOnTouchOutside = YES;

//注意:在哪些页面打开了,在页面消失的时候要记得关闭,因为这个只要打开就是针对整个项目的。


【8】 获取字符串首字母工具类

NSString+PinYin ;
使用案例:tableView区头使用首字母显示,自己私藏的,没有原文地址哦,如果有需要的,在网上搜索这个类名应该也能找到,如果找不到,请联系我,我可以发给你哟!下面是基本的使用方法,
Here is the code:

#import "SelectStationViewController.h"
#import "NSString+PinYin.h"

@interface SelectStationViewController ()

@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (nonatomic,strong) NSMutableArray * dataArray;

@end

@implementation SelectStationViewController

-(NSMutableArray *)dataArray
{
    if (!_dataArray) {
        _dataArray = [[NSMutableArray alloc]init];
    }
    return _dataArray;
}
- (void)viewDidLoad {
    [super viewDidLoad];
    [self setNavigationTitle:@"站点选择"];
    
    NSArray * array = @[@"北京",@"常州",@"成都",@"东湾",@"峨山",@"佛山",@"上海",@"苏州",@"广州",@"鹤壁",@"郑州",@"杭州",@"深圳",@"大连",@"石家庄",@"黑龙江",@"辽宁"];
    [self.dataArray addObjectsFromArray:[array arrayWithPinYinFirstLetterFormat]];
    
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cellID"];
}

-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return self.dataArray.count;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    NSArray * array = self.dataArray[section][@"content"];
    return array.count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell * cell = [tableView dequeueReusableCellWithIdentifier:@"cellID" forIndexPath:indexPath];
    if (!cell)
    {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cellID"];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    NSDictionary * dic = self.dataArray[indexPath.section];
    NSArray * array = dic[@"content"];
    cell.textLabel.text = array[indexPath.row];
    
    return cell;
}

-(NSString *)tableView:(UITableView *)tableView titleForHeaderInSection:(NSInteger)section
{
    NSDictionary *dict = self.dataArray[section];
    NSString *title = dict[@"firstLetter"];
    
    return title;
}
//右侧索引 字节数
-(NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView
{
    NSMutableArray *resultArray = [NSMutableArray array];
    for (NSDictionary *dict in self.dataArray) {
        NSString *title = dict[@"firstLetter"];
        [resultArray addObject:title];
    }
    return  resultArray;
}
//点击右侧索引表调用
-(NSInteger)tableView:(UITableView *)tableView sectionForSectionIndexTitle:(NSString *)title atIndex:(NSInteger)index
{
    return index;
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 44;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 30;
}

【9】火星坐标互转工具类:LocationConverter

这个也是私藏的,虽然网上也有很多火星坐标转换的工具类,相信大家都能找到哈,如果找不到,我依然会和大家分享的,记得告诉我哦!


今天先写到这里喽,第三方使用的还很多的,以后还会陆续更新,谢谢大家的持续关注!

你可能感兴趣的:(项目开发常用的第三方使用感受与链接)