使用教程?https://www.cnblogs.com/hs-funky/p/6780203.html
上京寫(xiě)的?http://www.reibang.com/p/88d9fb58ef2e
如何更新:
1.修改sosProjectBase組建倉(cāng)庫(kù)并修改sosProjectBase.podspec的版本號(hào)
2.cd /Users/zhangzuoren/Desktop/sosProjectBase/Example
3.pod install
4.cd /Users/zhangzuoren/Desktop/sosProjectBase
5.git status
6.git add .
7.git commit -m'基礎(chǔ)組件'
8.pod lib lint --use-libraries --allow-warnings
9.git status
10.git add .
11.git commit -m '編輯spec文件'
12.git remote add origin https://gitee.com/zhangzuoren/sosProjectBase.git
13.git push origin master
14.git tag '0.1.0' (要與sosProjectBase.podspec文件中的tag值保持一致)
15.git push --tags
16.pod spec lint --use-libraries --allow-warnings
17.pod repo
18.pod repo push sosProjectSpec *.podspec --use-libraries --allow-warnings
目錄
CocoaPod:
1.AFNetworking
2.Bugtags
3.CYLTabBarController
4.FMDB
5.IQKeyboardManager
6.Masonry
7.MBProgressHUD
8.MJRefresh
9.pop
10.RTRootNavigationController
11.SDAutoLayout
12.SDWebImage
13.TZImagePickerController
14.YYKit
ProjectBase:
1.BAButton
2.BATextView
3.BMTemplateLayoutCell
4.BRPickerView
5.Color(Chameleon)
6.DZNEmptyDataSet
7.Http
8.JQFMDB
9.Launch(XHLaunchAd)
10.NullSafe
11.XLImageViewer
12.MHActionSheet
13.WZLBadge
14.YJProgressHUDK
Base(基類(lèi))
1.BaseViewController
2.BaseModel
3.BaseTableView
4.BaseTableViewCell
5.BaseIconLabel
6.BaseWeb
7.BaseSectionView
8.BaseSelectController
BaseTools(工具類(lèi))
1.Category(分類(lèi))
2.Const(定義)【包括單例文件創(chuàng)建】
3.Macro(宏)
AFNetworking
https://github.com/AFNetworking/AFNetworking
Bugtags
用戶(hù)記錄并上傳用戶(hù)使用App時(shí)的崩潰情況
官網(wǎng):https://www.bugtags.com/
基本用法:#importBugtagsOptions *options = [[BugtagsOptions alloc] init];
options.trackingCrashes = YES; // 具體可設(shè)置的屬性請(qǐng)查看 Bugtags.h
#ifdef DEBUG
? ? [Bugtags startWithAppKey:@"APP_KEY" invocationEvent:BTGInvocationEventNone options:options];
#else
? ? [Bugtags startWithAppKey:@"APP_KEY" invocationEvent:BTGInvocationEventNone options:options];
#endif
CYLTabBarController
自定義Tabbar
https://github.com/ChenYilong/CYLTabBarController
基本用法:
需要導(dǎo)入TabBarControllerConfig
#import "TabBarControllerConfig.h"
TabBarControllerConfig *tabBarControllerConfig = [[TabBarControllerConfig alloc] init];
CYLTabBarController *tabBarController = tabBarControllerConfig.tabBarController;
[self.window setRootViewController:tabBarController];
tabBarController.delegate = self;
#pragma mark - tabBarControllerDelegate
- (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController {
? ? [[self cyl_tabBarController] updateSelectionStatusIfNeededForTabBarController:tabBarController shouldSelectViewController:viewController];
? ? return YES;
}
-(void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController{
? ? UIView *animationView;
? ? animationView = [viewController.cyl_tabButton cyl_tabImageView];
? ? [self addScaleAnimationOnView:animationView repeatCount:1];
}
#pragma mark - 縮放動(dòng)畫(huà)
- (void)addScaleAnimationOnView:(UIView *)animationView repeatCount:(float)repeatCount {
? ? //需要實(shí)現(xiàn)的幀動(dòng)畫(huà),這里根據(jù)需求自定義
? ? CAKeyframeAnimation *animation = [CAKeyframeAnimation animation];
? ? animation.keyPath = @"transform.scale";
? ? animation.values = @[@1.0,@1.3,@0.9,@1.15,@0.95,@1.02,@1.0];
? ? animation.duration = 1;
? ? animation.repeatCount = repeatCount;
? ? animation.calculationMode = kCAAnimationCubic;
? ? [animationView.layer addAnimation:animation forKey:nil];
}
FMDB
https://github.com/ccgus/fmdb
IQKeyboardManager
https://github.com/hackiftekhar/IQKeyboardManager
基本用法:(只要導(dǎo)入就起作用)
#import "IQKeyboardManager.h"
[IQKeyboardManager sharedManager].shouldResignOnTouchOutside = YES;//點(diǎn)擊空白處自動(dòng)收回鍵盤(pán)
Masonry
https://github.com/SnapKit/Masonry
MBProgressHUD
https://github.com/jdg/MBProgressHUD
MJRefresh
https://github.com/CoderMJLee/MJRefresh
pop
https://github.com/facebook/pop
RTRootNavigationController
自定義的導(dǎo)航欄
https://github.com/rickytan/RTRootNavigationController
SDAutoLayout
自動(dòng)布局框架
https://github.com/gsdios/SDAutoLayout
SDWebImage
https://github.com/rs/SDWebImage
TZImagePickerController
一個(gè)支持多選、選原圖和視頻的圖片選擇器涂圆,同時(shí)有預(yù)覽、裁剪功能https://github.com/banchichen/TZImagePickerController
基本用法:
#import "TZImagePickerController.h"
TZImagePickerController *imagePickerVc = [[TZImagePickerController alloc] initWithMaxImagesCount:9 delegate:self]; // 你可以通過(guò)block或者代理结蟋,來(lái)得到用戶(hù)選擇的照片.
[imagePickerVc setDidFinishPickingPhotosHandle:^(NSArray *photos, NSArray *assets) {
}];?
[self presentViewController:imagePickerVc animated:YES completion:nil];
如果運(yùn)行在iOS6或7系統(tǒng)上哥攘,用的是AssetsLibrary庫(kù)獲取照片資源针史。
如果運(yùn)行在iOS8及以上系統(tǒng)上贡定,用的是PhotoKit庫(kù)獲取照片資源涂召。
YYKit
強(qiáng)大的類(lèi)庫(kù)床佳,無(wú)需解釋
https://github.com/ibireme/YYKit
BAButton
1页藻、UIButton 圖片贩汉、文字自定義布局
2躯嫉、UIButton 自定義切圓角乳丰,可以設(shè)置任意一個(gè)角的角半徑
3尤泽、 UIButton 各種狀態(tài)下背景顏色脆淹、字體签杈、border瘫镇、font、動(dòng)畫(huà)等的監(jiān)測(cè)及改變
4答姥、 UIButton 倒計(jì)時(shí)的封裝铣除,兩行代碼搞定倒計(jì)時(shí)!
5鹦付、注意:文字尚粘、字體大小、圖片等設(shè)置一定要在設(shè)置 ba_button_setBAButtonLayoutType 之前設(shè)置敲长,要不然計(jì)算會(huì)以默認(rèn)字體大小計(jì)算郎嫁,導(dǎo)致位置偏移
BATextView
1、可以自定義 placeholder的(字體祈噪、顏色)泽铛、文字(字體、顏色)?
2辑鲤、可以自定義 輸入文字的(字體盔腔、顏色)、文字(字體、顏色)
3弛随、可以自動(dòng)布局澈蝙,自適應(yīng)高度,實(shí)時(shí)監(jiān)測(cè)輸入文字的最大高度
4撵幽、可以實(shí)時(shí)監(jiān)測(cè)輸入文字的最大個(gè)數(shù)灯荧,可以限制最大輸入文字字?jǐn)?shù)
5、用分類(lèi)整理盐杂,無(wú)需改動(dòng)源碼即可實(shí)現(xiàn)各種自定義功能
6逗载、【方法新增】:默認(rèn) self.text 文字時(shí)的屬性 ba_text:TextView 默認(rèn) text,注意:一定要用 ba_text 設(shè)置链烈,用系統(tǒng)的 self.text 設(shè)置無(wú)效厉斟,此外,如果有默認(rèn) text强衡,一定要在 ba_placeholder 賦值之前賦值 ba_text擦秽,要不然會(huì)出現(xiàn)文字顏色錯(cuò)亂!
7漩勤、【方法新增】:新增 UITextView 代理 shouldChangeTextInRange 改成 block (ba_textView_ShouldChangeTextInRangeBlock)返回感挥,使用更加方便!?
BMTemplateLayoutCell
配合Masonry發(fā)揮出強(qiáng)大的Cell自動(dòng)布局作用
https://github.com/asiosldh/UITableView-BMTemplateLayoutCell
基本用法:
#import "UITableView+BMTemplateLayoutCell.h"
#import "UITableViewCell+BMReusable.h"
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
? ? return [BMMasonryCell bm_cellWithTableView:tableView];
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
? ? BMModel *model = self.dataArray[indexPath.row];
? ? return [tableView bm_heightForCellWithCellClass:BMMasonryCell.class cacheByKey:model.ID configuration:^(__kindof BMMasonryCell *cell) {
? ? ? ? cell.model = model;
? ? }];
}
BRPickerView
多功能選擇器越败,包括日期選擇器触幼、時(shí)間選擇器、地址選擇器究飞、自定義單列字符串選擇器置谦、
自定義多列字符串選擇器
https://github.com/borenfocus/BRPickerView
Color(Chameleon)
一套Flat風(fēng)格的顏色庫(kù)
https://github.com/viccalexander/Chameleon
DZNEmptyDataSet
缺省頁(yè)
https://github.com/dzenbot/DZNEmptyDataSet
Http
自己封裝的Http網(wǎng)絡(luò)請(qǐng)求庫(kù)
內(nèi)容由上京填寫(xiě)
JQFMDB
基于fmdb封裝的數(shù)據(jù)庫(kù)使用庫(kù)
https://github.com/gaojunquan/JQFMDB
Launch(XHLaunchAd)
開(kāi)屏廣告、啟動(dòng)廣告解決方案-支持靜態(tài)/動(dòng)態(tài)圖片廣告,mp4視頻廣告,全屏/半屏廣告
https://github.com/CoderZhuXH/XHLaunchAd
基本用法:
需導(dǎo)入AppDelegate+XHLaunchAd文件
#import "AppDelegate+XHLaunchAd.h"
/* 啟動(dòng)廣告頁(yè) */
[self setupXHLaunchAd];
MJExtension
你懂的
NullSafe
在項(xiàng)目開(kāi)發(fā)中亿傅,和服務(wù)端交互數(shù)據(jù)時(shí)媒峡,若服務(wù)端數(shù)據(jù)為空時(shí),會(huì)出現(xiàn) 葵擎,客戶(hù)端解析時(shí)會(huì) Crash谅阿,為了增強(qiáng)程序的健壯性,減少 Crash 的發(fā)生坪蚁,可以使用?NullSafe?這個(gè)類(lèi)別奔穿。它對(duì)不識(shí)別的類(lèi)型返回 nil,而不是拋出異常敏晤,它減少了例如因?yàn)?JSON 解析中 數(shù)組或字符串為 null 時(shí)導(dǎo)致的 Crash贱田。
使用時(shí)只需要把 NullSafe.m 文件拖進(jìn)工程就可以了,它在程序運(yùn)行時(shí)自動(dòng)加載嘴脾,你不需要再導(dǎo)入其他頭文件了男摧。
如果想要禁止 NullSafe 的話(huà)蔬墩,需要設(shè)置:NULLSAFE_ENABLED=0,或者在 .pch 文件中添加:
#ifdef DEBUG
#define NULLSAFE_ENABLED 0
#endif
XLImageViewer
仿照今日頭條的圖片瀏覽工具
https://github.com/mengxianliang/XLImageViewer
基本用法:
#import "XLImageViewer.h"
[[XLImageViewer shareInstanse] showNetImages:@[<圖片地址數(shù)組>] index:from:];
MHActionSheet
類(lèi)似微信的ActionSheet
基本用法:
MHActionSheet *actionSheet = [[MHActionSheet alloc] initSheetWithTitle:nil style:MHSheetStyleWeiChat itemTitles:@[@"拍照",@"從相冊(cè)選取"]];
[actionSheet didFinishSelectIndex:^(NSInteger index, NSString *title) {? ? ? ? ? ? ? ?
? }];
WZLBadge
一行代碼實(shí)現(xiàn)Badge效果
https://github.com/weng1250/WZLBadge
基本用法:
import "WZLBadgeImport.h"
[<#view#> showBadge]
[<#view#> showBadgeWithStyle:WBadgeStyleRedDot?value:0 animationType:WBadgeAnimTypeShake]
[<#view#> showBadgeWithStyle:WBadgeStyleNumber?value:99 animationType:WBadgeAnimTypeShake]
[<#view#> clearBadge]
[<#view#> resumeBadge]
YJProgressHUDK
1耗拓、提示消息
[YJProgressHUD showMessage:@"顯示文字拇颅,1s隱藏" inView:self.view]; //如果想設(shè)置N秒隱藏,用這個(gè)[YJProgressHUD showMessage:@"顯示文字乔询,Ns隱藏" inView:self.view afterDelayTime:3.0];
2樟插、加載成功
[YJProgressHUD showSuccess:@"加載成功" inview:self.view];
3、加載中 //菊花
[YJProgressHUD showProgress:@"加載中..." inView:self.view];
4竿刁、自定義動(dòng)畫(huà)(序列幀實(shí)現(xiàn))
BaseViewController
isHidenleftBarItem:是否隱藏導(dǎo)航欄左邊返回按鈕(如首頁(yè)等頁(yè)面黄锤,需設(shè)置為YES)
leftIsClose:是否顯示左邊返回按鈕為關(guān)閉的樣式(如present出的頁(yè)面,需設(shè)置為YES)
如需設(shè)置導(dǎo)航欄右邊按鈕食拜,可調(diào)用:
[self setupRightItem:<#是否是文字#> rightItem:<#如果是文字鸵熟,請(qǐng)輸入文字內(nèi)容;如果是圖片负甸,請(qǐng)輸入圖片名稱(chēng)#>];
/* 左右按鈕的點(diǎn)擊事件 */
-(void)leftItemClick;
-(void)rightItemClick;
BaseModel
預(yù)留
BaseTableView
設(shè)置缺省頁(yè)樣式流强,基本的樣式已枚舉出來(lái),直接調(diào)用:[self.tableView setLoadType:<#LoadType#>];
如需自定義樣式呻待,可調(diào)用方法:
-(void)setLoadTypeCustomWithImage:(UIImage *)image andTitle:(NSString *)title andDes:(NSString *)des;
BaseTableViewCell
設(shè)置cell的上方和下方的分割線(xiàn)
直接設(shè)置:(默認(rèn)為CellLineStyleNone)
[cell setBottomLineStyle:<#CellLineStyle#>];
[cell setTopLineStyle:<#CellLineStyle#>];
BaseIconLabel
設(shè)置帶圖標(biāo)的Label
UIImageView *image=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 16, 16)]; ? ?
image.image=[UIImage imageNamed:@"<圖片名稱(chēng)>"]; ? ?
_iconLabel=[[BaseIconLabel alloc] init];? ??
_iconLabel.direction = kIconAtLeft;? ? //設(shè)置圖標(biāo)在左文字在右
_iconLabel.gap = 5.f;? ? //設(shè)置圖標(biāo)和文字間隔
_iconLabel.iconView = image;? ? //設(shè)置圖標(biāo)圖片
[self.view addSubview:_iconLabel]; ? ?
[_iconLabel sizeToFitWithText:@"<文字內(nèi)容>"];? ? //設(shè)置文字內(nèi)容打月,label會(huì)根據(jù)文字長(zhǎng)度自動(dòng)拉伸,通過(guò)_iconLabel.width來(lái)獲得適配后的寬度
BaseWeb
跳轉(zhuǎn)并訪(fǎng)問(wèn)一個(gè)外部鏈接
BaseWeb *web=[BaseWeb new];
[web loadWebURLSring:@"<鏈接地址>"]; ? ?
[self.navigationController pushViewController:web animated:YES];
BaseSectionView
+(BaseSectionView *)initWithColor:(UIColor *)color;//返回一個(gè)sectionView
BaseSelectController
僅支持單選的控制器带污,傳入標(biāo)題僵控、可選擇的值與已選的值香到,并設(shè)置block
@property (nonatomic, copy) void(^selectBlock)(NSString *value);
-(void)setTitle:(NSString *)title andValues:(NSArray *)values andSelectValue:(NSString *)selectValue;