├── .DS_Store ├── .gitignore ├── HTool.podspec ├── HTool ├── .DS_Store ├── Foundation+Log.m ├── HCollectionViewCircleLayout.h ├── HCollectionViewCircleLayout.m ├── HCollectionViewFallLayout.h ├── HCollectionViewFallLayout.m ├── HCollectionViewLineLayout.h ├── HCollectionViewLineLayout.m ├── HCollectionViewStackLayout.h ├── HCollectionViewStackLayout.m ├── HConst.h ├── HDateTool.h ├── HDateTool.m └── HSingleton.h ├── HToolDemo ├── .DS_Store ├── Classes │ └── .DS_Store ├── HToolDemo.xcodeproj │ ├── project.pbxproj │ └── project.xcworkspace │ │ └── contents.xcworkspacedata └── HToolDemo │ ├── .DS_Store │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Base.lproj │ ├── LaunchScreen.storyboard │ └── Main.storyboard │ ├── Classes │ ├── .DS_Store │ ├── HCollectionViewLayoutDemo.h │ ├── HCollectionViewLayoutDemo.m │ ├── HConst │ │ ├── HConstCell.h │ │ ├── HConstCell.m │ │ ├── HConstController.h │ │ └── HConstController.m │ └── HDate │ │ ├── HDateDemo.h │ │ └── HDateDemo.m │ ├── Info.plist │ ├── main.m │ └── status.plist ├── LICENSE ├── MBProgressHUD+show.h ├── MBProgressHUD+show.m └── README.md /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOSzwj/HTool/28372fbed1320645eda0e90d7130edc4367b8ccb/.DS_Store -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Xcode 2 | # 3 | # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore 4 | 5 | ## Build generated 6 | build/ 7 | DerivedData 8 | 9 | ## Various settings 10 | *.pbxuser 11 | !default.pbxuser 12 | *.mode1v3 13 | !default.mode1v3 14 | *.mode2v3 15 | !default.mode2v3 16 | *.perspectivev3 17 | !default.perspectivev3 18 | xcuserdata 19 | 20 | ## Other 21 | *.xccheckout 22 | *.moved-aside 23 | *.xcuserstate 24 | *.xcscmblueprint 25 | 26 | ## Obj-C/Swift specific 27 | *.hmap 28 | *.ipa 29 | 30 | # CocoaPods 31 | # 32 | # We recommend against adding the Pods directory to your .gitignore. However 33 | # you should judge for yourself, the pros and cons are mentioned at: 34 | # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control 35 | # 36 | # Pods/ 37 | 38 | # Carthage 39 | # 40 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 41 | # Carthage/Checkouts 42 | 43 | Carthage/Build 44 | 45 | # fastlane 46 | # 47 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 48 | # screenshots whenever they are needed. 49 | # For more information about the recommended setup visit: 50 | # https://github.com/fastlane/fastlane/blob/master/docs/Gitignore.md 51 | 52 | fastlane/report.xml 53 | fastlane/screenshots 54 | -------------------------------------------------------------------------------- /HTool.podspec: -------------------------------------------------------------------------------- 1 | 2 | Pod::Spec.new do |s| 3 | 4 | s.name = "HTool" 5 | s.version = "0.0.1" 6 | s.summary = "工具类" 7 | 8 | s.description = <<-DESC 9 | 自己写的一些工具类 10 | DESC 11 | 12 | s.homepage = "https://github.com/hare27/HTool" 13 | 14 | s.license = { :type => "MIT", :file => "FILE_LICENSE" } 15 | 16 | s.author = { "hare27" => "hare27@foxmail.com" } 17 | 18 | s.platform = :ios 19 | 20 | s.osx.deployment_target = "10.7" 21 | 22 | s.source = { :git => "https://github.com/hare27/HTool.git", :tag => "0.0.1" } 23 | 24 | s.source_files = "HTool", "HTool/**/*.{h,m}" 25 | 26 | end 27 | -------------------------------------------------------------------------------- /HTool/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOSzwj/HTool/28372fbed1320645eda0e90d7130edc4367b8ccb/HTool/.DS_Store -------------------------------------------------------------------------------- /HTool/Foundation+Log.m: -------------------------------------------------------------------------------- 1 | 2 | #import 3 | 4 | @implementation NSDictionary (Log) 5 | - (NSString *)descriptionWithLocale:(id)locale 6 | { 7 | NSMutableString *str = [NSMutableString string]; 8 | 9 | [str appendString:@"{\n"]; 10 | 11 | // 遍历字典的所有键值对 12 | [self enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { 13 | [str appendFormat:@"\t%@ = %@,\n", key, obj]; 14 | }]; 15 | 16 | [str appendString:@"}"]; 17 | 18 | // 查出最后一个,的范围 19 | NSRange range = [str rangeOfString:@"," options:NSBackwardsSearch]; 20 | if (range.length != 0) { 21 | // 删掉最后一个, 22 | [str deleteCharactersInRange:range]; 23 | } 24 | 25 | return str; 26 | } 27 | @end 28 | 29 | @implementation NSArray (Log) 30 | - (NSString *)descriptionWithLocale:(id)locale 31 | { 32 | NSMutableString *str = [NSMutableString string]; 33 | 34 | [str appendString:@"[\n"]; 35 | 36 | // 遍历数组的所有元素 37 | [self enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { 38 | [str appendFormat:@"%@,\n", obj]; 39 | }]; 40 | 41 | [str appendString:@"]"]; 42 | 43 | // 查出最后一个,的范围 44 | NSRange range = [str rangeOfString:@"," options:NSBackwardsSearch]; 45 | if (range.length != 0) { 46 | // 删掉最后一个, 47 | [str deleteCharactersInRange:range]; 48 | } 49 | 50 | return str; 51 | } 52 | @end 53 | -------------------------------------------------------------------------------- /HTool/HCollectionViewCircleLayout.h: -------------------------------------------------------------------------------- 1 | //********************************* 2 | //******* 小兔子——圆形布局 ******* 3 | //********************************* 4 | 5 | #import 6 | 7 | @interface HCollectionViewCircleLayout : UICollectionViewLayout 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /HTool/HCollectionViewCircleLayout.m: -------------------------------------------------------------------------------- 1 | // 2 | // HARCollectionViewCircleLayout.m 3 | // collectionView 4 | // 5 | // Created by tarena on 15/6/24. 6 | // Copyright (c) 2015年 tarena. All rights reserved. 7 | // 8 | 9 | #import "HCollectionViewCircleLayout.h" 10 | 11 | @implementation HCollectionViewCircleLayout 12 | 13 | //设置显示的边界发生改变的时候重新布局 14 | -(BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds{ 15 | return YES; 16 | } 17 | 18 | //返回所有cell的相关设置 19 | -(NSArray *)layoutAttributesForElementsInRect:(CGRect)rect{ 20 | 21 | NSMutableArray *attributeses=[NSMutableArray array]; 22 | //获取cell的数量 23 | NSInteger itemCount=[self.collectionView numberOfItemsInSection:0]; 24 | //遍历 25 | for (int i=0; i 6 | 7 | @interface HCollectionViewFallLayout : UICollectionViewFlowLayout 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /HTool/HCollectionViewFallLayout.m: -------------------------------------------------------------------------------- 1 | 2 | // 3 | 4 | #import "HCollectionViewFallLayout.h" 5 | 6 | @interface HCollectionViewFallLayout() 7 | 8 | @property(nonatomic,strong)NSMutableArray *attArr; 9 | 10 | @end 11 | 12 | @implementation HCollectionViewFallLayout 13 | 14 | // 界面更新了,是否响应 15 | - (BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds{ 16 | return YES; 17 | } 18 | 19 | // 界面将要显示的时候会掉 20 | - (void)prepareLayout{ 21 | [super prepareLayout]; 22 | [self.attArr removeAllObjects]; 23 | self.scrollDirection = UICollectionViewScrollDirectionVertical; 24 | for (int i = 0; i < 20; i ++) { 25 | NSIndexPath *indexPath = [NSIndexPath indexPathForItem:i inSection:0]; 26 | UICollectionViewLayoutAttributes *att = [self layoutAttributesForItemAtIndexPath:indexPath]; 27 | [self.attArr addObject:att]; 28 | } 29 | } 30 | 31 | // 设置滚动区域的大小 32 | - (CGSize)collectionViewContentSize{ 33 | CGFloat screenW = [UIScreen mainScreen].bounds.size.width; 34 | CGFloat miniW = (screenW - 30)/3.0; 35 | CGFloat sectionH = miniW * 4 + 10; 36 | int count = (int)([self layoutAttributesForElementsInRect:[UIScreen mainScreen].bounds].count); 37 | int sectionCount = count/6; 38 | int areaCount = count%6; 39 | CGFloat height = 10 + (sectionH + 10)*sectionCount; 40 | 41 | switch (areaCount) { 42 | case 0: 43 | case 1: 44 | case 2: 45 | height = height + miniW*2 + 10; 46 | break; 47 | case 3: 48 | case 4: 49 | case 5: 50 | height = height + sectionH; 51 | break; 52 | } 53 | return CGSizeMake(0, height); 54 | } 55 | 56 | // 返回所有cell的小秘书 57 | - (NSArray *)layoutAttributesForElementsInRect:(CGRect)rect{ 58 | return self.attArr; 59 | } 60 | 61 | // 返回每个cell的小秘书 62 | -(UICollectionViewLayoutAttributes *)layoutAttributesForItemAtIndexPath:(NSIndexPath *)indexPath{ 63 | 64 | UICollectionViewLayoutAttributes *att = [super layoutAttributesForItemAtIndexPath:indexPath]; 65 | CGFloat screenW = [UIScreen mainScreen].bounds.size.width; 66 | CGFloat miniW = (screenW - 30)/3.0; 67 | CGFloat miniH = (miniW*2 - 10)/3.0; 68 | CGFloat sectionH = miniW * 4 + 10; 69 | //6个一个区,得到区 70 | int sectionNum = (int)(indexPath.row/6); 71 | //第几个 72 | int areaNum = indexPath.row%6; 73 | //取得区的高度 74 | CGFloat startY = 10 + (10+sectionH)*sectionNum; 75 | CGFloat cellY = startY; 76 | CGFloat cellX = 20 + miniW; 77 | CGFloat cellW = miniW*2; 78 | CGFloat cellH = miniH * 3 + 10; 79 | switch (areaNum) { 80 | case 0:{ 81 | cellX = 10; 82 | cellW = miniW; 83 | } 84 | break; 85 | case 1:{ 86 | cellH = miniH; 87 | } 88 | break; 89 | case 2:{ 90 | cellY = startY + miniH + 10; 91 | cellH = miniH * 2; 92 | } 93 | break; 94 | case 3:{ 95 | cellX = 10; 96 | cellY = miniW * 2 + 10 + startY; 97 | cellH = miniH; 98 | } 99 | break; 100 | case 4:{ 101 | cellX = 10; 102 | cellY = startY + miniH*4 + 30; 103 | cellH = miniH * 2; 104 | } 105 | break; 106 | case 5:{ 107 | cellX = 2*miniW + 20; 108 | cellY = miniW * 2 + 10 + startY; 109 | cellW = miniW; 110 | } 111 | break; 112 | } 113 | 114 | //得到当前小秘书 115 | att.frame = CGRectMake(cellX, cellY, cellW, cellH); 116 | 117 | return att; 118 | } 119 | 120 | -(NSMutableArray *)attArr{ 121 | if (_attArr == nil) { 122 | _attArr = [NSMutableArray array]; 123 | } 124 | return _attArr; 125 | } 126 | 127 | 128 | @end 129 | -------------------------------------------------------------------------------- /HTool/HCollectionViewLineLayout.h: -------------------------------------------------------------------------------- 1 | //********************************* 2 | //******* 小兔子线——性布局 ******* 3 | //********************************* 4 | 5 | #import 6 | 7 | @interface HCollectionViewLineLayout : UICollectionViewFlowLayout 8 | 9 | @end 10 | -------------------------------------------------------------------------------- /HTool/HCollectionViewLineLayout.m: -------------------------------------------------------------------------------- 1 | // 2 | // HARCollectionViewLineLayout.m 3 | // collectionView 4 | // 5 | // Created by tarena on 15/6/24. 6 | // Copyright (c) 2015年 tarena. All rights reserved. 7 | // 8 | 9 | #import "HCollectionViewLineLayout.h" 10 | 11 | #define spacing 150 12 | #define InsetSpacing 50 13 | #define itemWidth 100 14 | #define itemHeight 200 15 | 16 | @implementation HCollectionViewLineLayout 17 | 18 | //准备工作完成的时候回调 19 | -(void)prepareLayout{ 20 | //设置cell的大小 21 | self.itemSize=CGSizeMake(itemWidth, itemHeight); 22 | //设置滚动的方向 23 | self.scrollDirection=UICollectionViewScrollDirectionHorizontal; 24 | //设置cell之间的间距 25 | self.minimumLineSpacing=spacing; 26 | //设置显示间距 27 | self.sectionInset=UIEdgeInsetsMake(itemHeight, self.collectionView.frame.size.width/2-itemWidth/2, itemHeight, self.collectionView.frame.size.height/2); 28 | } 29 | 30 | //设置显示的边界发生改变的时候重新布局 31 | -(BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds{ 32 | return YES; 33 | } 34 | 35 | //scrollview停止滚动的时候回调 36 | //proposedContentOffset停止滚动时的位置 37 | //velocity滚动速度 38 | -(CGPoint)targetContentOffsetForProposedContentOffset:(CGPoint)proposedContentOffset withScrollingVelocity:(CGPoint)velocity{ 39 | 40 | //计算出滚动最后停留的范围 41 | CGRect lastRect; 42 | lastRect.origin=proposedContentOffset; 43 | lastRect.size=self.collectionView.frame.size; 44 | //取出范围内的所有attributes 45 | NSArray *attributeses=[self layoutAttributesForElementsInRect:lastRect]; 46 | //计算屏幕的中间的x值 47 | CGFloat centerX=proposedContentOffset.x+self.collectionView.frame.size.width/2; 48 | //遍历所有attributes 计算出最小距离 49 | CGFloat minSpacing=MAXFLOAT; 50 | for (UICollectionViewLayoutAttributes *attributes in attributeses) { 51 | minSpacing=MIN(MAXFLOAT, attributes.center.x-centerX); 52 | } 53 | return CGPointMake(proposedContentOffset.x+minSpacing, proposedContentOffset.y); 54 | } 55 | 56 | //设置cell的相关属性 57 | -(NSArray *)layoutAttributesForElementsInRect:(CGRect)rect{ 58 | //获取可视区域的frame 59 | CGRect visibleRect; 60 | visibleRect.origin=self.collectionView.contentOffset; 61 | visibleRect.size=self.collectionView.frame.size; 62 | //计算屏幕的中间的x值 63 | CGFloat centerX=visibleRect.origin.x+visibleRect.size.width/2; 64 | //获取所有的attributes 65 | NSArray *attributeses=[super layoutAttributesForElementsInRect:rect]; 66 | //遍历所有的attributes 67 | for (UICollectionViewLayoutAttributes *attributes in attributeses) { 68 | //获取cell的中心点的x左边 69 | CGFloat itemCenterX=attributes.center.x; 70 | //计算cell与屏幕中心点的距离 71 | CGFloat space=ABS(itemCenterX-centerX); 72 | if (space 7 | 8 | @interface HCollectionViewStackLayout : UICollectionViewLayout 9 | 10 | @end 11 | -------------------------------------------------------------------------------- /HTool/HCollectionViewStackLayout.m: -------------------------------------------------------------------------------- 1 | // 2 | // HARCollectionViewStackLayout.m 3 | // collectionView 4 | // 5 | // Created by tarena on 15/6/24. 6 | // Copyright (c) 2015年 tarena. All rights reserved. 7 | // 8 | 9 | #import "HCollectionViewStackLayout.h" 10 | 11 | @implementation HCollectionViewStackLayout 12 | 13 | //设置显示的边界发生改变的时候重新布局 14 | -(BOOL)shouldInvalidateLayoutForBoundsChange:(CGRect)newBounds{ 15 | return YES; 16 | } 17 | 18 | -(NSArray *)layoutAttributesForElementsInRect:(CGRect)rect{ 19 | 20 | NSMutableArray *attributeses=[NSMutableArray array]; 21 | //获取cell的数量 22 | NSInteger itemCount=[self.collectionView numberOfItemsInSection:0]; 23 | for (int i=0; i=5) { 44 | attributes.hidden=YES; 45 | }else{ 46 | //设置旋转角度 47 | attributes.transform=CGAffineTransformMakeRotation([angry[indexPath.item] floatValue]); 48 | //设置显示优先级 49 | attributes.zIndex=500-indexPath.item; 50 | } 51 | return attributes; 52 | } 53 | 54 | @end 55 | -------------------------------------------------------------------------------- /HTool/HConst.h: -------------------------------------------------------------------------------- 1 | // 2 | // HRHeader.h 3 | // 与乐笔记 4 | // 5 | // Created by hare27 on 16/2/1. 6 | // Copyright © 2016年 hare27. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | /** 只在oc的文件中,才能起作用*/ 12 | #ifdef __OBJC__ 13 | 14 | 15 | 16 | /** 自定义log*/ 17 | #ifdef DEBUG 18 | #define HLog(...) NSLog(@"%s %s %d \n %@\n\n",__FILE__,__func__,__LINE__,[NSString stringWithFormat:__VA_ARGS__]) 19 | #else 20 | #define HLog(...) 21 | #endif 22 | 23 | #define ud [NSUserDefaults standardUserDefaults] 24 | 25 | /** 随机整数*/ 26 | /** [0,x)*/ 27 | #define HRandInt(x) (arc4random()%x) 28 | /** [0,256)*/ 29 | #define HRand256 HRandInt(256) 30 | 31 | /** rgb颜色*/ 32 | #define HRGBColor(r, g, b) HRGBAColor(r, g, b, 255) 33 | #define HRGBAColor(r, g, b, a) [UIColor colorWithRed:(r)/255.0 green:(g)/255.0 blue:(b)/255.0 alpha:(a)/255.0] 34 | 35 | /** 随机色*/ 36 | #define HRandColor HRGBAColor(HRand256, HRand256, HRand256, 255) 37 | #define HRandAColor HRGBAColor(HRand256, HRand256, HRand256, HRand256) 38 | 39 | /** 屏幕宽*/ 40 | #define HScreenW [UIScreen mainScreen].bounds.size.width 41 | 42 | /** 屏幕高*/ 43 | #define HScreenH [UIScreen mainScreen].bounds.size.height 44 | 45 | 46 | #endif 47 | -------------------------------------------------------------------------------- /HTool/HDateTool.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDateTool.h 3 | // HToolDemo 4 | // 5 | // Created by hare27 on 16/8/6. 6 | // Copyright © 2016年 hare27. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HDateTool : NSObject 12 | 13 | +(instancetype)sharedDateTool; 14 | 15 | /** 判断一个日期是否今年*/ 16 | -(BOOL)dateIsThisYearForDate:(NSDate *)date; 17 | 18 | /** 判断一个日期是否本月*/ 19 | -(BOOL)dateIsThisMonthForDate:(NSDate *)date; 20 | 21 | /** 判断一个日期是否今天*/ 22 | -(BOOL)dateIsThisDayForDate:(NSDate *)date; 23 | 24 | /** 判断一个日期是否昨天*/ 25 | -(BOOL)dateIsYesterDayForDate:(NSDate *)date; 26 | 27 | 28 | /** 根据样式,获取字符串对应的date*/ 29 | -(NSDate *)getDateWithFormat:(NSString *)format Frome:(NSString *)str; 30 | 31 | 32 | /** 根据样式,获取date对应的字符串*/ 33 | -(NSString *)getStringWithFormat:(NSString *)format FromeDate:(NSDate *)date; 34 | 35 | /** 36 | * 获取一个时间距离现在的时间描述 37 | * 例如:刚刚/5分钟前/5小时前/昨天/多少天前/11月12/2014年11月 38 | * 昨天23:59分显示为昨天 39 | */ 40 | -(NSString *)getStringSinceNowForDate:(NSDate *)date; 41 | 42 | /** 43 | * 获取一个时间距离现在的时间具体描述 44 | * 例如:刚刚/5分钟前/5小时前/昨天/多少天前/11月12/2014年11月 45 | * 昨天23:59分显示为多少小时前或多少分钟前 46 | */ 47 | -(NSString *)getDetailStringSinceNowForDate:(NSDate *)date; 48 | 49 | 50 | @end 51 | -------------------------------------------------------------------------------- /HTool/HDateTool.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDateTool.m 3 | // HToolDemo 4 | // 5 | // Created by hare27 on 16/8/6. 6 | // Copyright © 2016年 hare27. All rights reserved. 7 | // 8 | 9 | #import "HDateTool.h" 10 | 11 | @interface HDateTool() 12 | 13 | @property(nonatomic,strong)NSDateFormatter *dateFormatter; 14 | 15 | @property(nonatomic,strong)NSCalendar *calendar; 16 | 17 | @end 18 | 19 | @implementation HDateTool 20 | 21 | +(instancetype)sharedDateTool{ 22 | static HDateTool *obj; 23 | static dispatch_once_t onceToken; 24 | dispatch_once(&onceToken, ^{ 25 | obj=[[self alloc]init]; 26 | }); 27 | return obj; 28 | } 29 | 30 | /** 判断一个日期是否今年*/ 31 | -(BOOL)dateIsThisYearForDate:(NSDate *)date{ 32 | NSCalendarUnit unit = NSCalendarUnitYear; 33 | NSDateComponents *cmps_date = [self.calendar components:unit fromDate:date]; 34 | NSDateComponents *cmps_now = [self.calendar components:unit fromDate:[NSDate date]]; 35 | return cmps_now.year == cmps_date.year; 36 | } 37 | 38 | /** 判断一个日期是否本月*/ 39 | -(BOOL)dateIsThisMonthForDate:(NSDate *)date{ 40 | NSCalendarUnit unit = NSCalendarUnitYear | NSCalendarUnitMonth; 41 | NSDateComponents *cmps_date = [self.calendar components:unit fromDate:date]; 42 | NSDateComponents *cmps_now = [self.calendar components:unit fromDate:[NSDate date]]; 43 | return cmps_now.year == cmps_date.year 44 | &&cmps_now.month == cmps_date.month; 45 | } 46 | 47 | /** 判断一个日期是否今天*/ 48 | -(BOOL)dateIsThisDayForDate:(NSDate *)date{ 49 | NSCalendarUnit unit = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay; 50 | NSDateComponents *cmps_date = [self.calendar components:unit fromDate:date]; 51 | NSDateComponents *cmps_now = [self.calendar components:unit fromDate:[NSDate date]]; 52 | return cmps_now.year == cmps_date.year 53 | &&cmps_now.month == cmps_date.month 54 | &&cmps_now.day == cmps_date.day; 55 | } 56 | 57 | /** 判断一个日期是否昨天*/ 58 | -(BOOL)dateIsYesterDayForDate:(NSDate *)date{ 59 | NSDate *now = [NSDate date]; 60 | NSCalendarUnit unit = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay; 61 | NSDateComponents *cmps_date = [self.calendar components:unit fromDate:date]; 62 | NSDateComponents *cmps_now = [self.calendar components:unit fromDate:now]; 63 | 64 | if (cmps_now.day == 1) { 65 | // 前一天 66 | now = [NSDate dateWithTimeIntervalSinceNow:-60*60*24]; 67 | cmps_now = [self.calendar components:unit fromDate:now]; 68 | 69 | return cmps_now.year == cmps_date.year 70 | && cmps_now.month == cmps_date.month 71 | && cmps_now.day == cmps_date.day; 72 | 73 | }else{ 74 | return cmps_now.year == cmps_date.year 75 | && cmps_now.month == cmps_date.month 76 | && cmps_now.day - cmps_date.day == 1; 77 | } 78 | 79 | } 80 | 81 | /** 根据样式,获取date对应的字符串*/ 82 | -(NSString *)getStringWithFormat:(NSString *)format FromeDate:(NSDate *)date{ 83 | if (date == nil || format == nil || format.length == 0) { 84 | return nil; 85 | }else{ 86 | self.dateFormatter.dateFormat = format; 87 | return [self.dateFormatter stringFromDate:date]; 88 | } 89 | } 90 | 91 | 92 | /** 根据样式,获取字符串对应的date*/ 93 | -(NSDate *)getDateWithFormat:(NSString *)format Frome:(NSString *)str{ 94 | if (format == nil || format.length == 0 || str == nil || str.length == 0) { 95 | return nil; 96 | } 97 | self.dateFormatter.dateFormat = format; 98 | return [self.dateFormatter dateFromString:str]; 99 | } 100 | 101 | 102 | /** 103 | * 获取一个时间距离现在的时间描述 104 | * 例如:刚刚/5分钟前/5小时前/昨天/多少天前/11月12/2014年11月 105 | * 昨天23:59分显示为昨天 106 | */ 107 | -(NSString *)getStringSinceNowForDate:(NSDate *)date{ 108 | 109 | NSDate *date_temp = [NSDate date]; 110 | 111 | NSCalendarUnit unit = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond; 112 | NSDateComponents *cmps_date = [self.calendar components:unit fromDate:date]; 113 | NSDateComponents *cmps_now = [self.calendar components:unit fromDate:date_temp]; 114 | 115 | if ([self dateIsYesterDayForDate:date]) { 116 | return [NSString stringWithFormat:@"昨天%d点%d分",(int)cmps_date.hour,(int)cmps_date.minute]; 117 | }else if (cmps_now.year != cmps_date.year) { 118 | return [NSString stringWithFormat:@"%d年%d月%d日",(int)cmps_date.year,(int)cmps_date.month,(int)cmps_date.day]; 119 | }else if(cmps_now.month != cmps_date.month) { 120 | return [NSString stringWithFormat:@"%d月%d日%d点",(int)cmps_date.month,(int)cmps_date.day,(int)cmps_date.hour]; 121 | }else if(cmps_now.day - cmps_date.day > 1) { 122 | return [NSString stringWithFormat:@"%d月%d日%d点",(int)cmps_date.month,(int)cmps_date.day,(int)cmps_date.hour]; 123 | }else if(cmps_now.day - cmps_date.day < 0) { 124 | return @"系统时间错误"; 125 | } 126 | 127 | return [self getDetailStringSinceNowForDate:date]; 128 | 129 | } 130 | 131 | /** 132 | * 获取一个时间距离现在的时间具体描述 133 | * 例如:刚刚/5分钟前/5小时前/昨天/多少天前/11月12/2014年11月 134 | * 昨天23:59分显示为多少小时前或多少分钟前 135 | */ 136 | -(NSString *)getDetailStringSinceNowForDate:(NSDate *)date{ 137 | 138 | NSCalendarUnit unit = NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour | NSCalendarUnitMinute | NSCalendarUnitSecond; 139 | NSDateComponents *cmps = [self.calendar components:unit fromDate:date toDate:[NSDate date] options:0]; 140 | 141 | if (cmps.year) { 142 | return [NSString stringWithFormat:@"%d年前",(int)cmps.year]; 143 | }else if(cmps.month){ 144 | return [NSString stringWithFormat:@"%d个月前",(int)cmps.month]; 145 | }else if(cmps.day){ 146 | return [NSString stringWithFormat:@"%d天前",(int)cmps.day]; 147 | }else if(cmps.hour){ 148 | return [NSString stringWithFormat:@"%d个小时前",(int)cmps.hour]; 149 | }else if(cmps.minute){ 150 | return [NSString stringWithFormat:@"%d分钟前",(int)cmps.minute]; 151 | }else{ 152 | return @"刚刚"; 153 | } 154 | 155 | } 156 | 157 | 158 | - (NSCalendar *)calendar { 159 | if(_calendar == nil) { 160 | if ([UIDevice currentDevice].systemVersion.floatValue >= 8.0) { 161 | _calendar = [NSCalendar calendarWithIdentifier:NSCalendarIdentifierGregorian]; 162 | }else{ 163 | _calendar = [NSCalendar currentCalendar]; 164 | } 165 | } 166 | return _calendar; 167 | } 168 | 169 | - (NSDateFormatter *)dateFormatter { 170 | if(_dateFormatter == nil) { 171 | _dateFormatter = [[NSDateFormatter alloc] init]; 172 | } 173 | return _dateFormatter; 174 | } 175 | @end 176 | -------------------------------------------------------------------------------- /HTool/HSingleton.h: -------------------------------------------------------------------------------- 1 | // .h文件 2 | #define HSingletonH(name) + (instancetype)shared##name; 3 | 4 | // .m文件 5 | #if __has_feature(objc_arc) 6 | 7 | #define HSingletonM(name) \ 8 | static id _instace; \ 9 | \ 10 | + (id)allocWithZone:(struct _NSZone *)zone \ 11 | { \ 12 | static dispatch_once_t onceToken; \ 13 | dispatch_once(&onceToken, ^{ \ 14 | _instace = [super allocWithZone:zone]; \ 15 | }); \ 16 | return _instace; \ 17 | } \ 18 | \ 19 | + (instancetype)shared##name \ 20 | { \ 21 | static dispatch_once_t onceToken; \ 22 | dispatch_once(&onceToken, ^{ \ 23 | _instace = [[self alloc] init]; \ 24 | }); \ 25 | return _instace; \ 26 | } \ 27 | \ 28 | - (id)copyWithZone:(NSZone *)zone \ 29 | { \ 30 | return _instace; \ 31 | } 32 | 33 | #else 34 | 35 | #define HSingletonM(name) \ 36 | static id _instace; \ 37 | \ 38 | + (id)allocWithZone:(struct _NSZone *)zone \ 39 | { \ 40 | static dispatch_once_t onceToken; \ 41 | dispatch_once(&onceToken, ^{ \ 42 | _instace = [super allocWithZone:zone]; \ 43 | }); \ 44 | return _instace; \ 45 | } \ 46 | \ 47 | + (instancetype)shared##name \ 48 | { \ 49 | static dispatch_once_t onceToken; \ 50 | dispatch_once(&onceToken, ^{ \ 51 | _instace = [[self alloc] init]; \ 52 | }); \ 53 | return _instace; \ 54 | } \ 55 | \ 56 | - (id)copyWithZone:(NSZone *)zone \ 57 | { \ 58 | return _instace; \ 59 | } \ 60 | \ 61 | - (oneway void)release { } \ 62 | - (id)retain { return self; } \ 63 | - (NSUInteger)retainCount { return 1;} \ 64 | - (id)autorelease { return self;} 65 | 66 | #endif -------------------------------------------------------------------------------- /HToolDemo/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOSzwj/HTool/28372fbed1320645eda0e90d7130edc4367b8ccb/HToolDemo/.DS_Store -------------------------------------------------------------------------------- /HToolDemo/Classes/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOSzwj/HTool/28372fbed1320645eda0e90d7130edc4367b8ccb/HToolDemo/Classes/.DS_Store -------------------------------------------------------------------------------- /HToolDemo/HToolDemo.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 41837B411E8F3F3800BCE43A /* NSObject+KVO.m in Sources */ = {isa = PBXBuildFile; fileRef = 41837B321E8F3F3800BCE43A /* NSObject+KVO.m */; }; 11 | 41837B421E8F3F3800BCE43A /* NSObject+Model.m in Sources */ = {isa = PBXBuildFile; fileRef = 41837B341E8F3F3800BCE43A /* NSObject+Model.m */; }; 12 | 41837B431E8F3F3800BCE43A /* NSString+file.m in Sources */ = {isa = PBXBuildFile; fileRef = 41837B361E8F3F3800BCE43A /* NSString+file.m */; }; 13 | 41837B441E8F3F3800BCE43A /* NSString+Frame.m in Sources */ = {isa = PBXBuildFile; fileRef = 41837B381E8F3F3800BCE43A /* NSString+Frame.m */; }; 14 | 41837B451E8F3F3800BCE43A /* NSString+Hash.m in Sources */ = {isa = PBXBuildFile; fileRef = 41837B3A1E8F3F3800BCE43A /* NSString+Hash.m */; }; 15 | 41837B461E8F3F3800BCE43A /* NSString+Legal.m in Sources */ = {isa = PBXBuildFile; fileRef = 41837B3C1E8F3F3800BCE43A /* NSString+Legal.m */; }; 16 | 41837B471E8F3F3800BCE43A /* NSString+QRCode.m in Sources */ = {isa = PBXBuildFile; fileRef = 41837B3E1E8F3F3800BCE43A /* NSString+QRCode.m */; }; 17 | 41837B481E8F3F3800BCE43A /* NSString+Sub.m in Sources */ = {isa = PBXBuildFile; fileRef = 41837B401E8F3F3800BCE43A /* NSString+Sub.m */; }; 18 | B857F8A61D9231F00079209B /* HCollectionViewCircleLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = B857F89F1D9231F00079209B /* HCollectionViewCircleLayout.m */; }; 19 | B857F8A71D9231F00079209B /* HCollectionViewFallLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = B857F8A11D9231F00079209B /* HCollectionViewFallLayout.m */; }; 20 | B857F8A81D9231F00079209B /* HCollectionViewLineLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = B857F8A31D9231F00079209B /* HCollectionViewLineLayout.m */; }; 21 | B857F8A91D9231F00079209B /* HCollectionViewStackLayout.m in Sources */ = {isa = PBXBuildFile; fileRef = B857F8A51D9231F00079209B /* HCollectionViewStackLayout.m */; }; 22 | B857F8AD1D9233780079209B /* HCollectionViewLayoutDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = B857F8AC1D9233780079209B /* HCollectionViewLayoutDemo.m */; }; 23 | B87184F61D0E980F004D464D /* HConstController.m in Sources */ = {isa = PBXBuildFile; fileRef = B87184F51D0E980F004D464D /* HConstController.m */; }; 24 | B87184F91D0E98D4004D464D /* HConstCell.m in Sources */ = {isa = PBXBuildFile; fileRef = B87184F81D0E98D4004D464D /* HConstCell.m */; }; 25 | B87377291CFA70AD002A5E25 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = B87377281CFA70AD002A5E25 /* main.m */; }; 26 | B873772C1CFA70AD002A5E25 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = B873772B1CFA70AD002A5E25 /* AppDelegate.m */; }; 27 | B87377321CFA70AD002A5E25 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B87377301CFA70AD002A5E25 /* Main.storyboard */; }; 28 | B87377341CFA70AD002A5E25 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = B87377331CFA70AD002A5E25 /* Assets.xcassets */; }; 29 | B87377371CFA70AD002A5E25 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = B87377351CFA70AD002A5E25 /* LaunchScreen.storyboard */; }; 30 | B87377441CFA70D3002A5E25 /* Foundation+Log.m in Sources */ = {isa = PBXBuildFile; fileRef = B873773F1CFA70D3002A5E25 /* Foundation+Log.m */; }; 31 | B87377471CFA71C3002A5E25 /* status.plist in Resources */ = {isa = PBXBuildFile; fileRef = B87377461CFA71C3002A5E25 /* status.plist */; }; 32 | B87C4F9A1D55C63E0066BBFF /* HDateTool.m in Sources */ = {isa = PBXBuildFile; fileRef = B87C4F991D55C63E0066BBFF /* HDateTool.m */; }; 33 | B87C4F9D1D55C6A80066BBFF /* HDateDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = B87C4F9C1D55C6A80066BBFF /* HDateDemo.m */; }; 34 | /* End PBXBuildFile section */ 35 | 36 | /* Begin PBXFileReference section */ 37 | 41837B311E8F3F3800BCE43A /* NSObject+KVO.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+KVO.h"; sourceTree = ""; }; 38 | 41837B321E8F3F3800BCE43A /* NSObject+KVO.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+KVO.m"; sourceTree = ""; }; 39 | 41837B331E8F3F3800BCE43A /* NSObject+Model.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+Model.h"; sourceTree = ""; }; 40 | 41837B341E8F3F3800BCE43A /* NSObject+Model.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+Model.m"; sourceTree = ""; }; 41 | 41837B351E8F3F3800BCE43A /* NSString+file.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+file.h"; sourceTree = ""; }; 42 | 41837B361E8F3F3800BCE43A /* NSString+file.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+file.m"; sourceTree = ""; }; 43 | 41837B371E8F3F3800BCE43A /* NSString+Frame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+Frame.h"; sourceTree = ""; }; 44 | 41837B381E8F3F3800BCE43A /* NSString+Frame.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+Frame.m"; sourceTree = ""; }; 45 | 41837B391E8F3F3800BCE43A /* NSString+Hash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+Hash.h"; sourceTree = ""; }; 46 | 41837B3A1E8F3F3800BCE43A /* NSString+Hash.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+Hash.m"; sourceTree = ""; }; 47 | 41837B3B1E8F3F3800BCE43A /* NSString+Legal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+Legal.h"; sourceTree = ""; }; 48 | 41837B3C1E8F3F3800BCE43A /* NSString+Legal.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+Legal.m"; sourceTree = ""; }; 49 | 41837B3D1E8F3F3800BCE43A /* NSString+QRCode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+QRCode.h"; sourceTree = ""; }; 50 | 41837B3E1E8F3F3800BCE43A /* NSString+QRCode.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+QRCode.m"; sourceTree = ""; }; 51 | 41837B3F1E8F3F3800BCE43A /* NSString+Sub.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSString+Sub.h"; sourceTree = ""; }; 52 | 41837B401E8F3F3800BCE43A /* NSString+Sub.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSString+Sub.m"; sourceTree = ""; }; 53 | B857F89E1D9231F00079209B /* HCollectionViewCircleLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HCollectionViewCircleLayout.h; sourceTree = ""; }; 54 | B857F89F1D9231F00079209B /* HCollectionViewCircleLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HCollectionViewCircleLayout.m; sourceTree = ""; }; 55 | B857F8A01D9231F00079209B /* HCollectionViewFallLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HCollectionViewFallLayout.h; sourceTree = ""; }; 56 | B857F8A11D9231F00079209B /* HCollectionViewFallLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HCollectionViewFallLayout.m; sourceTree = ""; }; 57 | B857F8A21D9231F00079209B /* HCollectionViewLineLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HCollectionViewLineLayout.h; sourceTree = ""; }; 58 | B857F8A31D9231F00079209B /* HCollectionViewLineLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HCollectionViewLineLayout.m; sourceTree = ""; }; 59 | B857F8A41D9231F00079209B /* HCollectionViewStackLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HCollectionViewStackLayout.h; sourceTree = ""; }; 60 | B857F8A51D9231F00079209B /* HCollectionViewStackLayout.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HCollectionViewStackLayout.m; sourceTree = ""; }; 61 | B857F8AB1D9233780079209B /* HCollectionViewLayoutDemo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HCollectionViewLayoutDemo.h; sourceTree = ""; }; 62 | B857F8AC1D9233780079209B /* HCollectionViewLayoutDemo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HCollectionViewLayoutDemo.m; sourceTree = ""; }; 63 | B87184F41D0E980F004D464D /* HConstController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HConstController.h; sourceTree = ""; }; 64 | B87184F51D0E980F004D464D /* HConstController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HConstController.m; sourceTree = ""; }; 65 | B87184F71D0E98D4004D464D /* HConstCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HConstCell.h; sourceTree = ""; }; 66 | B87184F81D0E98D4004D464D /* HConstCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HConstCell.m; sourceTree = ""; }; 67 | B87377241CFA70AD002A5E25 /* HToolDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HToolDemo.app; sourceTree = BUILT_PRODUCTS_DIR; }; 68 | B87377281CFA70AD002A5E25 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 69 | B873772A1CFA70AD002A5E25 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 70 | B873772B1CFA70AD002A5E25 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 71 | B87377311CFA70AD002A5E25 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 72 | B87377331CFA70AD002A5E25 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 73 | B87377361CFA70AD002A5E25 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 74 | B87377381CFA70AD002A5E25 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 75 | B873773F1CFA70D3002A5E25 /* Foundation+Log.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "Foundation+Log.m"; sourceTree = ""; }; 76 | B87377401CFA70D3002A5E25 /* HConst.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HConst.h; sourceTree = ""; }; 77 | B87377431CFA70D3002A5E25 /* HSingleton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HSingleton.h; sourceTree = ""; }; 78 | B87377461CFA71C3002A5E25 /* status.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = status.plist; sourceTree = ""; }; 79 | B87C4F981D55C63E0066BBFF /* HDateTool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDateTool.h; sourceTree = ""; }; 80 | B87C4F991D55C63E0066BBFF /* HDateTool.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HDateTool.m; sourceTree = ""; }; 81 | B87C4F9B1D55C6A80066BBFF /* HDateDemo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HDateDemo.h; sourceTree = ""; }; 82 | B87C4F9C1D55C6A80066BBFF /* HDateDemo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HDateDemo.m; sourceTree = ""; }; 83 | /* End PBXFileReference section */ 84 | 85 | /* Begin PBXFrameworksBuildPhase section */ 86 | B87377211CFA70AD002A5E25 /* Frameworks */ = { 87 | isa = PBXFrameworksBuildPhase; 88 | buildActionMask = 2147483647; 89 | files = ( 90 | ); 91 | runOnlyForDeploymentPostprocessing = 0; 92 | }; 93 | /* End PBXFrameworksBuildPhase section */ 94 | 95 | /* Begin PBXGroup section */ 96 | 41837B301E8F3F3800BCE43A /* HFoundationCategory */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 41837B311E8F3F3800BCE43A /* NSObject+KVO.h */, 100 | 41837B321E8F3F3800BCE43A /* NSObject+KVO.m */, 101 | 41837B331E8F3F3800BCE43A /* NSObject+Model.h */, 102 | 41837B341E8F3F3800BCE43A /* NSObject+Model.m */, 103 | 41837B351E8F3F3800BCE43A /* NSString+file.h */, 104 | 41837B361E8F3F3800BCE43A /* NSString+file.m */, 105 | 41837B371E8F3F3800BCE43A /* NSString+Frame.h */, 106 | 41837B381E8F3F3800BCE43A /* NSString+Frame.m */, 107 | 41837B391E8F3F3800BCE43A /* NSString+Hash.h */, 108 | 41837B3A1E8F3F3800BCE43A /* NSString+Hash.m */, 109 | 41837B3B1E8F3F3800BCE43A /* NSString+Legal.h */, 110 | 41837B3C1E8F3F3800BCE43A /* NSString+Legal.m */, 111 | 41837B3D1E8F3F3800BCE43A /* NSString+QRCode.h */, 112 | 41837B3E1E8F3F3800BCE43A /* NSString+QRCode.m */, 113 | 41837B3F1E8F3F3800BCE43A /* NSString+Sub.h */, 114 | 41837B401E8F3F3800BCE43A /* NSString+Sub.m */, 115 | ); 116 | name = HFoundationCategory; 117 | path = ../../../HFoundationCategory/HFoundationCategory; 118 | sourceTree = ""; 119 | }; 120 | B857F8AA1D9233520079209B /* HCollectionViewLayout */ = { 121 | isa = PBXGroup; 122 | children = ( 123 | B857F8AB1D9233780079209B /* HCollectionViewLayoutDemo.h */, 124 | B857F8AC1D9233780079209B /* HCollectionViewLayoutDemo.m */, 125 | ); 126 | name = HCollectionViewLayout; 127 | sourceTree = ""; 128 | }; 129 | B87184F21D0E97EF004D464D /* Classes */ = { 130 | isa = PBXGroup; 131 | children = ( 132 | B857F8AA1D9233520079209B /* HCollectionViewLayout */, 133 | B87C4F971D55C6120066BBFF /* HDate */, 134 | B87184F31D0E97EF004D464D /* HConst */, 135 | ); 136 | path = Classes; 137 | sourceTree = ""; 138 | }; 139 | B87184F31D0E97EF004D464D /* HConst */ = { 140 | isa = PBXGroup; 141 | children = ( 142 | B87184F41D0E980F004D464D /* HConstController.h */, 143 | B87184F51D0E980F004D464D /* HConstController.m */, 144 | B87184F71D0E98D4004D464D /* HConstCell.h */, 145 | B87184F81D0E98D4004D464D /* HConstCell.m */, 146 | ); 147 | path = HConst; 148 | sourceTree = ""; 149 | }; 150 | B873771B1CFA70AD002A5E25 = { 151 | isa = PBXGroup; 152 | children = ( 153 | B87377261CFA70AD002A5E25 /* HToolDemo */, 154 | B87377251CFA70AD002A5E25 /* Products */, 155 | ); 156 | sourceTree = ""; 157 | }; 158 | B87377251CFA70AD002A5E25 /* Products */ = { 159 | isa = PBXGroup; 160 | children = ( 161 | B87377241CFA70AD002A5E25 /* HToolDemo.app */, 162 | ); 163 | name = Products; 164 | sourceTree = ""; 165 | }; 166 | B87377261CFA70AD002A5E25 /* HToolDemo */ = { 167 | isa = PBXGroup; 168 | children = ( 169 | 41837B301E8F3F3800BCE43A /* HFoundationCategory */, 170 | B873773E1CFA70D3002A5E25 /* HTool */, 171 | B87184F21D0E97EF004D464D /* Classes */, 172 | B873772A1CFA70AD002A5E25 /* AppDelegate.h */, 173 | B873772B1CFA70AD002A5E25 /* AppDelegate.m */, 174 | B87377301CFA70AD002A5E25 /* Main.storyboard */, 175 | B87377331CFA70AD002A5E25 /* Assets.xcassets */, 176 | B87377351CFA70AD002A5E25 /* LaunchScreen.storyboard */, 177 | B87377381CFA70AD002A5E25 /* Info.plist */, 178 | B87377271CFA70AD002A5E25 /* Supporting Files */, 179 | ); 180 | path = HToolDemo; 181 | sourceTree = ""; 182 | }; 183 | B87377271CFA70AD002A5E25 /* Supporting Files */ = { 184 | isa = PBXGroup; 185 | children = ( 186 | B87377461CFA71C3002A5E25 /* status.plist */, 187 | B87377281CFA70AD002A5E25 /* main.m */, 188 | ); 189 | name = "Supporting Files"; 190 | sourceTree = ""; 191 | }; 192 | B873773E1CFA70D3002A5E25 /* HTool */ = { 193 | isa = PBXGroup; 194 | children = ( 195 | B857F89E1D9231F00079209B /* HCollectionViewCircleLayout.h */, 196 | B857F89F1D9231F00079209B /* HCollectionViewCircleLayout.m */, 197 | B857F8A01D9231F00079209B /* HCollectionViewFallLayout.h */, 198 | B857F8A11D9231F00079209B /* HCollectionViewFallLayout.m */, 199 | B857F8A21D9231F00079209B /* HCollectionViewLineLayout.h */, 200 | B857F8A31D9231F00079209B /* HCollectionViewLineLayout.m */, 201 | B857F8A41D9231F00079209B /* HCollectionViewStackLayout.h */, 202 | B857F8A51D9231F00079209B /* HCollectionViewStackLayout.m */, 203 | B873773F1CFA70D3002A5E25 /* Foundation+Log.m */, 204 | B87377401CFA70D3002A5E25 /* HConst.h */, 205 | B87377431CFA70D3002A5E25 /* HSingleton.h */, 206 | B87C4F981D55C63E0066BBFF /* HDateTool.h */, 207 | B87C4F991D55C63E0066BBFF /* HDateTool.m */, 208 | ); 209 | name = HTool; 210 | path = ../../HTool; 211 | sourceTree = ""; 212 | }; 213 | B87C4F971D55C6120066BBFF /* HDate */ = { 214 | isa = PBXGroup; 215 | children = ( 216 | B87C4F9B1D55C6A80066BBFF /* HDateDemo.h */, 217 | B87C4F9C1D55C6A80066BBFF /* HDateDemo.m */, 218 | ); 219 | path = HDate; 220 | sourceTree = ""; 221 | }; 222 | /* End PBXGroup section */ 223 | 224 | /* Begin PBXNativeTarget section */ 225 | B87377231CFA70AD002A5E25 /* HToolDemo */ = { 226 | isa = PBXNativeTarget; 227 | buildConfigurationList = B873773B1CFA70AD002A5E25 /* Build configuration list for PBXNativeTarget "HToolDemo" */; 228 | buildPhases = ( 229 | B87377201CFA70AD002A5E25 /* Sources */, 230 | B87377211CFA70AD002A5E25 /* Frameworks */, 231 | B87377221CFA70AD002A5E25 /* Resources */, 232 | ); 233 | buildRules = ( 234 | ); 235 | dependencies = ( 236 | ); 237 | name = HToolDemo; 238 | productName = HToolDemo; 239 | productReference = B87377241CFA70AD002A5E25 /* HToolDemo.app */; 240 | productType = "com.apple.product-type.application"; 241 | }; 242 | /* End PBXNativeTarget section */ 243 | 244 | /* Begin PBXProject section */ 245 | B873771C1CFA70AD002A5E25 /* Project object */ = { 246 | isa = PBXProject; 247 | attributes = { 248 | LastUpgradeCheck = 0800; 249 | ORGANIZATIONNAME = hare27; 250 | TargetAttributes = { 251 | B87377231CFA70AD002A5E25 = { 252 | CreatedOnToolsVersion = 7.3.1; 253 | DevelopmentTeam = PBCZXCK2TK; 254 | }; 255 | }; 256 | }; 257 | buildConfigurationList = B873771F1CFA70AD002A5E25 /* Build configuration list for PBXProject "HToolDemo" */; 258 | compatibilityVersion = "Xcode 3.2"; 259 | developmentRegion = English; 260 | hasScannedForEncodings = 0; 261 | knownRegions = ( 262 | en, 263 | Base, 264 | ); 265 | mainGroup = B873771B1CFA70AD002A5E25; 266 | productRefGroup = B87377251CFA70AD002A5E25 /* Products */; 267 | projectDirPath = ""; 268 | projectRoot = ""; 269 | targets = ( 270 | B87377231CFA70AD002A5E25 /* HToolDemo */, 271 | ); 272 | }; 273 | /* End PBXProject section */ 274 | 275 | /* Begin PBXResourcesBuildPhase section */ 276 | B87377221CFA70AD002A5E25 /* Resources */ = { 277 | isa = PBXResourcesBuildPhase; 278 | buildActionMask = 2147483647; 279 | files = ( 280 | B87377371CFA70AD002A5E25 /* LaunchScreen.storyboard in Resources */, 281 | B87377341CFA70AD002A5E25 /* Assets.xcassets in Resources */, 282 | B87377471CFA71C3002A5E25 /* status.plist in Resources */, 283 | B87377321CFA70AD002A5E25 /* Main.storyboard in Resources */, 284 | ); 285 | runOnlyForDeploymentPostprocessing = 0; 286 | }; 287 | /* End PBXResourcesBuildPhase section */ 288 | 289 | /* Begin PBXSourcesBuildPhase section */ 290 | B87377201CFA70AD002A5E25 /* Sources */ = { 291 | isa = PBXSourcesBuildPhase; 292 | buildActionMask = 2147483647; 293 | files = ( 294 | B857F8A61D9231F00079209B /* HCollectionViewCircleLayout.m in Sources */, 295 | B873772C1CFA70AD002A5E25 /* AppDelegate.m in Sources */, 296 | 41837B411E8F3F3800BCE43A /* NSObject+KVO.m in Sources */, 297 | B87C4F9D1D55C6A80066BBFF /* HDateDemo.m in Sources */, 298 | 41837B471E8F3F3800BCE43A /* NSString+QRCode.m in Sources */, 299 | B857F8A81D9231F00079209B /* HCollectionViewLineLayout.m in Sources */, 300 | 41837B431E8F3F3800BCE43A /* NSString+file.m in Sources */, 301 | B87377291CFA70AD002A5E25 /* main.m in Sources */, 302 | B87184F61D0E980F004D464D /* HConstController.m in Sources */, 303 | B857F8AD1D9233780079209B /* HCollectionViewLayoutDemo.m in Sources */, 304 | B857F8A91D9231F00079209B /* HCollectionViewStackLayout.m in Sources */, 305 | B857F8A71D9231F00079209B /* HCollectionViewFallLayout.m in Sources */, 306 | 41837B441E8F3F3800BCE43A /* NSString+Frame.m in Sources */, 307 | B87184F91D0E98D4004D464D /* HConstCell.m in Sources */, 308 | 41837B481E8F3F3800BCE43A /* NSString+Sub.m in Sources */, 309 | 41837B461E8F3F3800BCE43A /* NSString+Legal.m in Sources */, 310 | B87377441CFA70D3002A5E25 /* Foundation+Log.m in Sources */, 311 | B87C4F9A1D55C63E0066BBFF /* HDateTool.m in Sources */, 312 | 41837B451E8F3F3800BCE43A /* NSString+Hash.m in Sources */, 313 | 41837B421E8F3F3800BCE43A /* NSObject+Model.m in Sources */, 314 | ); 315 | runOnlyForDeploymentPostprocessing = 0; 316 | }; 317 | /* End PBXSourcesBuildPhase section */ 318 | 319 | /* Begin PBXVariantGroup section */ 320 | B87377301CFA70AD002A5E25 /* Main.storyboard */ = { 321 | isa = PBXVariantGroup; 322 | children = ( 323 | B87377311CFA70AD002A5E25 /* Base */, 324 | ); 325 | name = Main.storyboard; 326 | sourceTree = ""; 327 | }; 328 | B87377351CFA70AD002A5E25 /* LaunchScreen.storyboard */ = { 329 | isa = PBXVariantGroup; 330 | children = ( 331 | B87377361CFA70AD002A5E25 /* Base */, 332 | ); 333 | name = LaunchScreen.storyboard; 334 | sourceTree = ""; 335 | }; 336 | /* End PBXVariantGroup section */ 337 | 338 | /* Begin XCBuildConfiguration section */ 339 | B87377391CFA70AD002A5E25 /* Debug */ = { 340 | isa = XCBuildConfiguration; 341 | buildSettings = { 342 | ALWAYS_SEARCH_USER_PATHS = NO; 343 | CLANG_ANALYZER_NONNULL = YES; 344 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 345 | CLANG_CXX_LIBRARY = "libc++"; 346 | CLANG_ENABLE_MODULES = YES; 347 | CLANG_ENABLE_OBJC_ARC = YES; 348 | CLANG_WARN_BOOL_CONVERSION = YES; 349 | CLANG_WARN_CONSTANT_CONVERSION = YES; 350 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 351 | CLANG_WARN_EMPTY_BODY = YES; 352 | CLANG_WARN_ENUM_CONVERSION = YES; 353 | CLANG_WARN_INFINITE_RECURSION = YES; 354 | CLANG_WARN_INT_CONVERSION = YES; 355 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 356 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 357 | CLANG_WARN_UNREACHABLE_CODE = YES; 358 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 359 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 360 | COPY_PHASE_STRIP = NO; 361 | DEBUG_INFORMATION_FORMAT = dwarf; 362 | ENABLE_STRICT_OBJC_MSGSEND = YES; 363 | ENABLE_TESTABILITY = YES; 364 | GCC_C_LANGUAGE_STANDARD = gnu99; 365 | GCC_DYNAMIC_NO_PIC = NO; 366 | GCC_NO_COMMON_BLOCKS = YES; 367 | GCC_OPTIMIZATION_LEVEL = 0; 368 | GCC_PREPROCESSOR_DEFINITIONS = ( 369 | "DEBUG=1", 370 | "$(inherited)", 371 | ); 372 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 373 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 374 | GCC_WARN_UNDECLARED_SELECTOR = YES; 375 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 376 | GCC_WARN_UNUSED_FUNCTION = YES; 377 | GCC_WARN_UNUSED_VARIABLE = YES; 378 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 379 | MTL_ENABLE_DEBUG_INFO = YES; 380 | ONLY_ACTIVE_ARCH = YES; 381 | SDKROOT = iphoneos; 382 | TARGETED_DEVICE_FAMILY = "1,2"; 383 | }; 384 | name = Debug; 385 | }; 386 | B873773A1CFA70AD002A5E25 /* Release */ = { 387 | isa = XCBuildConfiguration; 388 | buildSettings = { 389 | ALWAYS_SEARCH_USER_PATHS = NO; 390 | CLANG_ANALYZER_NONNULL = YES; 391 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 392 | CLANG_CXX_LIBRARY = "libc++"; 393 | CLANG_ENABLE_MODULES = YES; 394 | CLANG_ENABLE_OBJC_ARC = YES; 395 | CLANG_WARN_BOOL_CONVERSION = YES; 396 | CLANG_WARN_CONSTANT_CONVERSION = YES; 397 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 398 | CLANG_WARN_EMPTY_BODY = YES; 399 | CLANG_WARN_ENUM_CONVERSION = YES; 400 | CLANG_WARN_INFINITE_RECURSION = YES; 401 | CLANG_WARN_INT_CONVERSION = YES; 402 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 403 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 404 | CLANG_WARN_UNREACHABLE_CODE = YES; 405 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 406 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 407 | COPY_PHASE_STRIP = NO; 408 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 409 | ENABLE_NS_ASSERTIONS = NO; 410 | ENABLE_STRICT_OBJC_MSGSEND = YES; 411 | GCC_C_LANGUAGE_STANDARD = gnu99; 412 | GCC_NO_COMMON_BLOCKS = YES; 413 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 414 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 415 | GCC_WARN_UNDECLARED_SELECTOR = YES; 416 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 417 | GCC_WARN_UNUSED_FUNCTION = YES; 418 | GCC_WARN_UNUSED_VARIABLE = YES; 419 | IPHONEOS_DEPLOYMENT_TARGET = 9.3; 420 | MTL_ENABLE_DEBUG_INFO = NO; 421 | SDKROOT = iphoneos; 422 | TARGETED_DEVICE_FAMILY = "1,2"; 423 | VALIDATE_PRODUCT = YES; 424 | }; 425 | name = Release; 426 | }; 427 | B873773C1CFA70AD002A5E25 /* Debug */ = { 428 | isa = XCBuildConfiguration; 429 | buildSettings = { 430 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 431 | DEVELOPMENT_TEAM = PBCZXCK2TK; 432 | INFOPLIST_FILE = HToolDemo/Info.plist; 433 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 434 | PRODUCT_BUNDLE_IDENTIFIER = hare27.com.HToolDemo; 435 | PRODUCT_NAME = "$(TARGET_NAME)"; 436 | }; 437 | name = Debug; 438 | }; 439 | B873773D1CFA70AD002A5E25 /* Release */ = { 440 | isa = XCBuildConfiguration; 441 | buildSettings = { 442 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 443 | DEVELOPMENT_TEAM = PBCZXCK2TK; 444 | INFOPLIST_FILE = HToolDemo/Info.plist; 445 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 446 | PRODUCT_BUNDLE_IDENTIFIER = hare27.com.HToolDemo; 447 | PRODUCT_NAME = "$(TARGET_NAME)"; 448 | }; 449 | name = Release; 450 | }; 451 | /* End XCBuildConfiguration section */ 452 | 453 | /* Begin XCConfigurationList section */ 454 | B873771F1CFA70AD002A5E25 /* Build configuration list for PBXProject "HToolDemo" */ = { 455 | isa = XCConfigurationList; 456 | buildConfigurations = ( 457 | B87377391CFA70AD002A5E25 /* Debug */, 458 | B873773A1CFA70AD002A5E25 /* Release */, 459 | ); 460 | defaultConfigurationIsVisible = 0; 461 | defaultConfigurationName = Release; 462 | }; 463 | B873773B1CFA70AD002A5E25 /* Build configuration list for PBXNativeTarget "HToolDemo" */ = { 464 | isa = XCConfigurationList; 465 | buildConfigurations = ( 466 | B873773C1CFA70AD002A5E25 /* Debug */, 467 | B873773D1CFA70AD002A5E25 /* Release */, 468 | ); 469 | defaultConfigurationIsVisible = 0; 470 | defaultConfigurationName = Release; 471 | }; 472 | /* End XCConfigurationList section */ 473 | }; 474 | rootObject = B873771C1CFA70AD002A5E25 /* Project object */; 475 | } 476 | -------------------------------------------------------------------------------- /HToolDemo/HToolDemo.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /HToolDemo/HToolDemo/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOSzwj/HTool/28372fbed1320645eda0e90d7130edc4367b8ccb/HToolDemo/HToolDemo/.DS_Store -------------------------------------------------------------------------------- /HToolDemo/HToolDemo/AppDelegate.h: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.h 3 | // HToolDemo 4 | // 5 | // Created by hare27 on 16/5/29. 6 | // Copyright © 2016年 hare27. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface AppDelegate : UIResponder 12 | 13 | @property (strong, nonatomic) UIWindow *window; 14 | 15 | 16 | @end 17 | 18 | -------------------------------------------------------------------------------- /HToolDemo/HToolDemo/AppDelegate.m: -------------------------------------------------------------------------------- 1 | // 2 | // AppDelegate.m 3 | // HToolDemo 4 | // 5 | // Created by hare27 on 16/5/29. 6 | // Copyright © 2016年 hare27. All rights reserved. 7 | // 8 | 9 | #import "AppDelegate.h" 10 | 11 | @interface AppDelegate () 12 | 13 | @end 14 | 15 | @implementation AppDelegate 16 | 17 | 18 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 19 | // Override point for customization after application launch. 20 | return YES; 21 | } 22 | 23 | - (void)applicationWillResignActive:(UIApplication *)application { 24 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. 25 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. 26 | } 27 | 28 | - (void)applicationDidEnterBackground:(UIApplication *)application { 29 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 30 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. 31 | } 32 | 33 | - (void)applicationWillEnterForeground:(UIApplication *)application { 34 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. 35 | } 36 | 37 | - (void)applicationDidBecomeActive:(UIApplication *)application { 38 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. 39 | } 40 | 41 | - (void)applicationWillTerminate:(UIApplication *)application { 42 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 43 | } 44 | 45 | @end 46 | -------------------------------------------------------------------------------- /HToolDemo/HToolDemo/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "ipad", 35 | "size" : "29x29", 36 | "scale" : "1x" 37 | }, 38 | { 39 | "idiom" : "ipad", 40 | "size" : "29x29", 41 | "scale" : "2x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "40x40", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "40x40", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "76x76", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "76x76", 61 | "scale" : "2x" 62 | } 63 | ], 64 | "info" : { 65 | "version" : 1, 66 | "author" : "xcode" 67 | } 68 | } -------------------------------------------------------------------------------- /HToolDemo/HToolDemo/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /HToolDemo/HToolDemo/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 119 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | -------------------------------------------------------------------------------- /HToolDemo/HToolDemo/Classes/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/iOSzwj/HTool/28372fbed1320645eda0e90d7130edc4367b8ccb/HToolDemo/HToolDemo/Classes/.DS_Store -------------------------------------------------------------------------------- /HToolDemo/HToolDemo/Classes/HCollectionViewLayoutDemo.h: -------------------------------------------------------------------------------- 1 | // 2 | // HCollectionVC.h 3 | // HToolDemo 4 | // 5 | // Created by hare27 on 16/9/21. 6 | // Copyright © 2016年 hare27. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HCollectionViewLayoutDemo : UIViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /HToolDemo/HToolDemo/Classes/HCollectionViewLayoutDemo.m: -------------------------------------------------------------------------------- 1 | // 2 | // HCollectionVC.m 3 | // HToolDemo 4 | // 5 | // Created by hare27 on 16/9/21. 6 | // Copyright © 2016年 hare27. All rights reserved. 7 | // 8 | 9 | #import "HCollectionViewLayoutDemo.h" 10 | #import "HCollectionViewFallLayout.h" 11 | #import "HCollectionViewLineLayout.h" 12 | #import "HCollectionViewCircleLayout.h" 13 | #import "HCollectionViewStackLayout.h" 14 | #import "HConst.h" 15 | 16 | @interface HCollectionViewLayoutDemo () 17 | 18 | @property(nonatomic,strong)UICollectionView *collectionView; 19 | 20 | @property(nonatomic,strong)NSMutableArray *layoutArr; 21 | 22 | @property(nonatomic,assign)int layoutIndex; 23 | 24 | @end 25 | 26 | @implementation HCollectionViewLayoutDemo 27 | 28 | static NSString * const reuseIdentifier = @"Cell"; 29 | 30 | - (void)viewDidLoad { 31 | [super viewDidLoad]; 32 | 33 | self.layoutArr = [NSMutableArray array]; 34 | 35 | self.layoutIndex = -1; 36 | 37 | self.automaticallyAdjustsScrollViewInsets = NO; 38 | 39 | // 基本布局 40 | [self.layoutArr addObject:[UICollectionViewFlowLayout class]]; 41 | // 瀑布流 42 | [self.layoutArr addObject:[HCollectionViewFallLayout class]]; 43 | // 线性 44 | [self.layoutArr addObject:[HCollectionViewLineLayout class]]; 45 | // 堆 46 | [self.layoutArr addObject:[HCollectionViewCircleLayout class]]; 47 | // 圆 48 | [self.layoutArr addObject:[HCollectionViewStackLayout class]]; 49 | 50 | [self changeLayout]; 51 | 52 | self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc]initWithTitle:@"切换布局" style:UIBarButtonItemStyleDone target:self action:@selector(changeLayout)]; 53 | 54 | } 55 | 56 | -(void)changeLayout{ 57 | 58 | self.layoutIndex ++; 59 | 60 | [self.collectionView removeFromSuperview]; 61 | 62 | CGRect rect = CGRectMake(0, 64, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height-64); 63 | 64 | UICollectionViewFlowLayout *layout = [[self.layoutArr[self.layoutIndex] alloc]init]; 65 | if (self.layoutIndex == 0) { 66 | layout.sectionInset = UIEdgeInsetsMake(10, 10, 10, 10); 67 | } 68 | 69 | 70 | self.collectionView = [[UICollectionView alloc]initWithFrame:rect collectionViewLayout:layout]; 71 | 72 | self.collectionView.backgroundColor = [UIColor whiteColor]; 73 | 74 | [self.view addSubview:self.collectionView]; 75 | 76 | self.collectionView.dataSource =self; 77 | self.collectionView.delegate = self; 78 | 79 | [self.collectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:reuseIdentifier]; 80 | 81 | if (self.layoutIndex == self.layoutArr.count - 1) { 82 | self.layoutIndex = -1; 83 | } 84 | 85 | } 86 | 87 | #pragma mark 88 | 89 | - (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section { 90 | return 20; 91 | } 92 | 93 | - (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath { 94 | 95 | UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:reuseIdentifier forIndexPath:indexPath]; 96 | cell.backgroundColor = HRandColor; 97 | 98 | return cell; 99 | } 100 | 101 | #pragma mark 102 | -(void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{ 103 | 104 | if (self.layoutIndex != 0) { 105 | self.layoutIndex = -1; 106 | [self changeLayout]; 107 | } 108 | 109 | 110 | } 111 | 112 | @end 113 | -------------------------------------------------------------------------------- /HToolDemo/HToolDemo/Classes/HConst/HConstCell.h: -------------------------------------------------------------------------------- 1 | // 2 | // HConstCell.h 3 | // HToolDemo 4 | // 5 | // Created by hare27 on 16/6/13. 6 | // Copyright © 2016年 hare27. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HConstCell : UITableViewCell 12 | 13 | @property (weak, nonatomic) IBOutlet UILabel *rgbLabel; 14 | @property (weak, nonatomic) IBOutlet UILabel *rgbaLabel; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /HToolDemo/HToolDemo/Classes/HConst/HConstCell.m: -------------------------------------------------------------------------------- 1 | // 2 | // HConstCell.m 3 | // HToolDemo 4 | // 5 | // Created by hare27 on 16/6/13. 6 | // Copyright © 2016年 hare27. All rights reserved. 7 | // 8 | 9 | #import "HConstCell.h" 10 | 11 | @implementation HConstCell 12 | 13 | - (void)awakeFromNib { 14 | [super awakeFromNib]; 15 | // Initialization code 16 | } 17 | 18 | - (void)setSelected:(BOOL)selected animated:(BOOL)animated { 19 | [super setSelected:selected animated:animated]; 20 | 21 | // Configure the view for the selected state 22 | } 23 | 24 | @end 25 | -------------------------------------------------------------------------------- /HToolDemo/HToolDemo/Classes/HConst/HConstController.h: -------------------------------------------------------------------------------- 1 | // 2 | // HConstController.h 3 | // HToolDemo 4 | // 5 | // Created by hare27 on 16/6/13. 6 | // Copyright © 2016年 hare27. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HConstController : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /HToolDemo/HToolDemo/Classes/HConst/HConstController.m: -------------------------------------------------------------------------------- 1 | // 2 | // HConstController.m 3 | // HToolDemo 4 | // 5 | // Created by hare27 on 16/6/13. 6 | // Copyright © 2016年 hare27. All rights reserved. 7 | // 8 | 9 | #import "HConstController.h" 10 | #import "HConst.h" 11 | #import "HConstCell.h" 12 | 13 | @interface HConstController () 14 | 15 | 16 | @end 17 | 18 | @implementation HConstController 19 | 20 | - (void)viewDidLoad { 21 | [super viewDidLoad]; 22 | 23 | self.title = @"HConst"; 24 | 25 | // hlog 和 HScreenW 、 HScreenH 26 | HLog(@"屏幕宽:%lf,屏幕高:%lf",HScreenW,HScreenH); 27 | 28 | 29 | } 30 | 31 | #pragma mark - UITableViewDataSource 32 | -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{ 33 | return 20; 34 | } 35 | 36 | -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{ 37 | static NSString *cellIdentigy = @"const"; 38 | HConstCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentigy]; 39 | 40 | // 颜色相关 41 | cell.contentView.backgroundColor = HRandColor; 42 | cell.rgbLabel.backgroundColor = HRGBColor(15, 200, 180); 43 | cell.rgbaLabel.backgroundColor = HRGBAColor(15, 200, 180, 200); 44 | return cell; 45 | } 46 | 47 | @end 48 | -------------------------------------------------------------------------------- /HToolDemo/HToolDemo/Classes/HDate/HDateDemo.h: -------------------------------------------------------------------------------- 1 | // 2 | // HDateDemo.h 3 | // HToolDemo 4 | // 5 | // Created by hare27 on 16/8/6. 6 | // Copyright © 2016年 hare27. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface HDateDemo : UITableViewController 12 | 13 | @end 14 | -------------------------------------------------------------------------------- /HToolDemo/HToolDemo/Classes/HDate/HDateDemo.m: -------------------------------------------------------------------------------- 1 | // 2 | // HDateDemo.m 3 | // HToolDemo 4 | // 5 | // Created by hare27 on 16/8/6. 6 | // Copyright © 2016年 hare27. All rights reserved. 7 | // 8 | 9 | #import "HDateDemo.h" 10 | #import "HDateTool.h" 11 | 12 | @interface HDateDemo () 13 | 14 | @property(nonatomic,strong)NSMutableArray *dateArr; 15 | 16 | @property(nonatomic,strong)HDateTool *dateTool; 17 | 18 | @end 19 | 20 | @implementation HDateDemo 21 | 22 | - (void)viewDidLoad { 23 | [super viewDidLoad]; 24 | 25 | NSLog(@"%@",[self.dateTool getStringWithFormat:@"yyyy-MM-dd" FromeDate:[NSDate date]]); 26 | 27 | } 28 | 29 | #pragma mark - Table view data source 30 | - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { 31 | return self.dateArr.count; 32 | } 33 | 34 | - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { 35 | UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell"]; 36 | 37 | if (cell == nil) { 38 | cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:@"cell"]; 39 | } 40 | NSDate *date = self.dateArr[indexPath.row]; 41 | cell.textLabel.text = [date description]; 42 | // cell.detailTextLabel.text = [NSString stringWithFormat:@"%d",[self.dateTool dateIsThisMonthForDate:date]]; 43 | // cell.detailTextLabel.text = [self.dateTool detailStringSinceNowForDate:date]; 44 | cell.detailTextLabel.text = [self.dateTool getStringSinceNowForDate :date]; 45 | 46 | return cell; 47 | } 48 | 49 | 50 | - (NSMutableArray *)dateArr { 51 | if(_dateArr == nil) { 52 | _dateArr = [[NSMutableArray alloc] init]; 53 | [_dateArr addObject:[NSDate dateWithTimeIntervalSinceNow:-50]]; 54 | [_dateArr addObject:[NSDate dateWithTimeIntervalSinceNow:-60*20]]; 55 | [_dateArr addObject:[NSDate dateWithTimeIntervalSinceNow:-60*60*23]]; 56 | [_dateArr addObject:[NSDate dateWithTimeIntervalSinceNow:-60*60*24*17]]; 57 | [_dateArr addObject:[NSDate dateWithTimeIntervalSinceNow:-60*60*24*30*7]]; 58 | [_dateArr addObject:[NSDate dateWithTimeIntervalSinceNow:-60*60*24*30*17]]; 59 | } 60 | return _dateArr; 61 | } 62 | 63 | - (HDateTool *)dateTool { 64 | if(_dateTool == nil) { 65 | _dateTool = [[HDateTool alloc] init]; 66 | } 67 | return _dateTool; 68 | } 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /HToolDemo/HToolDemo/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIMainStoryboardFile 28 | Main 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UISupportedInterfaceOrientations~ipad 40 | 41 | UIInterfaceOrientationPortrait 42 | UIInterfaceOrientationPortraitUpsideDown 43 | UIInterfaceOrientationLandscapeLeft 44 | UIInterfaceOrientationLandscapeRight 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /HToolDemo/HToolDemo/main.m: -------------------------------------------------------------------------------- 1 | // 2 | // main.m 3 | // HToolDemo 4 | // 5 | // Created by hare27 on 16/5/29. 6 | // Copyright © 2016年 hare27. All rights reserved. 7 | // 8 | 9 | #import 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /HToolDemo/HToolDemo/status.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | statuses 6 | 7 | 8 | attitudes_count 9 | 3 10 | comments_count 11 | 0 12 | created_at 13 | 刚刚 14 | id 15 | 3824316141411024 16 | pic_urls 17 | 18 | 19 | thumbnail_pic 20 | http://ww4.sinaimg.cn/thumbnail/80292f4btw1eqi01myf23j20br08ogm0.jpg 21 | 22 | 23 | reposts_count 24 | 0 25 | source 26 | 来自微博 weibo.com 27 | text 28 | 媳妇手机没电了就放桌上了,我给充好放窗台了,2货媳妇发现手机电满的,很兴奋的跟我说她手机可以太阳能充电…#猪猪爱讲冷笑话# 29 | user 30 | 31 | mbrank 32 | 4 33 | mbtype 34 | 12 35 | name 36 | 猪猪爱讲冷笑话 37 | profile_image_url 38 | http://tp4.sinaimg.cn/2150182731/50/5613586011/1 39 | vip 40 | 41 | 42 | 43 | 44 | attitudes_count 45 | 1 46 | comments_count 47 | 0 48 | created_at 49 | 刚刚 50 | idstr 51 | 3824316137609270 52 | pic_urls 53 | 54 | 55 | thumbnail_pic 56 | http://ww4.sinaimg.cn/thumbnail/bd297795gw1eqhwikf145g208c0b4kgy.gif 57 | 58 | 59 | reposts_count 60 | 0 61 | source 62 | 来自即刻笔记 63 | text 64 | 这是我见过的剪刀中。。最丧心病狂的。。。妈蛋,看这体位。。多带劲儿。。。[拜拜] 65 | user 66 | 67 | mbrank 68 | 6 69 | mbtype 70 | 12 71 | name 72 | 嘴巴笑抽筋了 73 | profile_image_url 74 | http://tp2.sinaimg.cn/2655485361/50/40050952069/1 75 | vip 76 | 77 | 78 | 79 | 80 | attitudes_count 81 | 1 82 | comments_count 83 | 0 84 | created_at 85 | 刚刚 86 | idstr 87 | 3824316036693990 88 | pic_urls 89 | 90 | reposts_count 91 | 3 92 | retweeted_status 93 | 94 | attitudes_count 95 | 2 96 | comments_count 97 | 0 98 | created_at 99 | 3分钟前 100 | idstr 101 | 3824315345048798 102 | pic_urls 103 | 104 | reposts_count 105 | 16 106 | source 107 | 来自iPhone客户端 108 | text 109 | “你漂不漂亮”~“漂亮”~最近发了好多成精的萌宠,想看更多图片视频,请关注我[太开心]http://t.cn/RA2Nh5u 110 | user 111 | 112 | mbrank 113 | 2 114 | mbtype 115 | 11 116 | name 117 | 萌宠画报 118 | profile_image_url 119 | http://tp2.sinaimg.cn/2390694421/50/5711472339/0 120 | vip 121 | 122 | 123 | 124 | source 125 | 来自iPhone客户端 126 | text 127 | [笑cry]萌化//@好奇博士:嗯~//@同学你该吃药了:哈哈哈漂亮//@验算纸:又成精了[笑cry]//@猎奇菌:咪咪就是聪明//@水果酱:乖哦。嗯~ 128 | user 129 | 130 | mbrank 131 | 1 132 | mbtype 133 | 12 134 | name 135 | 趣事搞笑百科 136 | profile_image_url 137 | http://tp2.sinaimg.cn/2390654513/50/22820920787/1 138 | vip 139 | 140 | 141 | 142 | 143 | attitudes_count 144 | 5 145 | comments_count 146 | 1 147 | created_at 148 | 刚刚 149 | idstr 150 | 3824315965597597 151 | pic_urls 152 | 153 | 154 | thumbnail_pic 155 | http://ww2.sinaimg.cn/thumbnail/624c2f04jw1eqi1pp43ppj20fd0a9mxu.jpg 156 | 157 | 158 | reposts_count 159 | 3 160 | source 161 | 来自微博 weibo.com 162 | text 163 | 【恒天然认为牛奶价格可能已经触底】- 恒天然集团首席执行长史毕根斯表示,目前全脂奶粉的价格被低估,但如果中国重新出现牛奶供应短缺,全脂奶粉的价格就会回升至每吨3,500美元的水平。他表示,全脂奶粉价格可能已经触底。他还说,中国鲜奶供应过剩的局面已经扭转,价格已更加有利。 164 | user 165 | 166 | mbrank 167 | 0 168 | mbtype 169 | 0 170 | name 171 | 华尔街日报中文网 172 | profile_image_url 173 | http://tp1.sinaimg.cn/1649159940/50/5598692408/1 174 | vip 175 | 176 | 177 | 178 | 179 | attitudes_count 180 | 0 181 | comments_count 182 | 0 183 | created_at 184 | 刚刚 185 | idstr 186 | 3824315936386412 187 | pic_urls 188 | 189 | 190 | thumbnail_pic 191 | http://ww1.sinaimg.cn/thumbnail/636b674dgw1eqi1q6l64tj20fa082wf5.jpg 192 | 193 | 194 | reposts_count 195 | 1 196 | source 197 | 来自微博 weibo.com 198 | text 199 | 【财政部:寻求或放弃亚投行一票否决权命题不成立】日前,有媒体报道称,中国放弃在亚投行的一票否决权以换取欧洲国家支持。财政部副部长史耀斌就此问题回应称,亚投行将遵循公开、透明、高效的方式建立一个全新的多边开发机构。所谓中方寻求或放弃一票否决权是一个不成立的命题。(财政部网站) 200 | user 201 | 202 | mbrank 203 | 0 204 | mbtype 205 | 0 206 | name 207 | 财经国家周刊 208 | profile_image_url 209 | http://tp2.sinaimg.cn/1667983181/50/5662023381/1 210 | vip 211 | 212 | 213 | 214 | 215 | attitudes_count 216 | 3 217 | comments_count 218 | 0 219 | created_at 220 | 刚刚 221 | idstr 222 | 3824315777140974 223 | pic_urls 224 | 225 | reposts_count 226 | 7 227 | retweeted_status 228 | 229 | attitudes_count 230 | 2 231 | comments_count 232 | 0 233 | created_at 234 | 3分钟前 235 | idstr 236 | 3824315345048798 237 | pic_urls 238 | 239 | reposts_count 240 | 16 241 | source 242 | 来自iPhone客户端 243 | text 244 | “你漂不漂亮”~“漂亮”~最近发了好多成精的萌宠,想看更多图片视频,请关注我[太开心]http://t.cn/RA2Nh5u 245 | user 246 | 247 | mbrank 248 | 2 249 | mbtype 250 | 11 251 | name 252 | 萌宠画报 253 | profile_image_url 254 | http://tp2.sinaimg.cn/2390694421/50/5711472339/0 255 | vip 256 | 257 | 258 | 259 | source 260 | 来自iPhone客户端 261 | text 262 | 哈哈哈漂亮//@验算纸:又成精了[笑cry]//@猎奇菌:咪咪就是聪明//@水果酱:乖哦。嗯~ 263 | user 264 | 265 | mbrank 266 | 5 267 | mbtype 268 | 11 269 | name 270 | 同学你该吃药了 271 | profile_image_url 272 | http://tp1.sinaimg.cn/3209618112/50/40019694154/1 273 | vip 274 | 275 | 276 | 277 | 278 | attitudes_count 279 | 13 280 | comments_count 281 | 6 282 | created_at 283 | 2分钟前 284 | idstr 285 | 3824315638446702 286 | pic_urls 287 | 288 | 289 | thumbnail_pic 290 | http://ww3.sinaimg.cn/thumbnail/625ab309gw1eqi1b6svxaj20c80700t9.jpg 291 | 292 | 293 | thumbnail_pic 294 | http://ww4.sinaimg.cn/thumbnail/625ab309gw1eqi1b7vw9rj20c806haam.jpg 295 | 296 | 297 | thumbnail_pic 298 | http://ww4.sinaimg.cn/thumbnail/625ab309gw1eqi1b90rlqj20c807rwf0.jpg 299 | 300 | 301 | thumbnail_pic 302 | http://ww1.sinaimg.cn/thumbnail/625ab309gw1eqi1baorynj20c81jdwks.jpg 303 | 304 | 305 | reposts_count 306 | 8 307 | source 308 | 来自微博 weibo.com 309 | text 310 | 【央视5套节目尺度大引热议 网友为武媚娘叫冤】央视5套推出一档节目,召集12个人在7天的训练之后进行一场花游表演。选手穿着比基尼,露胸尺度比《武媚娘》还大。该栏目微博宣称:“跟大头说NO!不剪,我们不剪!”有网友认为在央视这样的大尺度都能播,为何《武媚娘》却要被剪……via网易娱乐 311 | user 312 | 313 | mbrank 314 | 0 315 | mbtype 316 | 0 317 | name 318 | 中国经营报 319 | profile_image_url 320 | http://tp2.sinaimg.cn/1650111241/50/5662078062/1 321 | vip 322 | 323 | 324 | 325 | 326 | attitudes_count 327 | 9 328 | comments_count 329 | 5 330 | created_at 331 | 2分钟前 332 | idstr 333 | 3824315629470387 334 | pic_urls 335 | 336 | 337 | thumbnail_pic 338 | http://ww4.sinaimg.cn/thumbnail/884f7263jw1eqi1p0i79dj20ci08caan.jpg 339 | 340 | 341 | reposts_count 342 | 11 343 | source 344 | 来自人民网微博 345 | text 346 | 【80后离婚有点任性:女性主动离婚占多数】“80后”成为近年离婚诉讼主体,呈三大特点:一是因家庭琐事导致离婚的“80后”明显高于其他人群,且女性主动提出离婚的占多数;二是“闪离”现象突出;三是子女抚养问题,成为“80后”离婚诉讼的争议重点。(人民法院报)http://t.cn/RAZQEQ9 347 | user 348 | 349 | mbrank 350 | 2 351 | mbtype 352 | 12 353 | name 354 | 人民网 355 | profile_image_url 356 | http://tp4.sinaimg.cn/2286908003/50/5684825992/1 357 | vip 358 | 359 | 360 | 361 | 362 | attitudes_count 363 | 15 364 | comments_count 365 | 2 366 | created_at 367 | 2分钟前 368 | idstr 369 | 3824315567255814 370 | pic_urls 371 | 372 | reposts_count 373 | 60 374 | retweeted_status 375 | 376 | attitudes_count 377 | 122 378 | comments_count 379 | 33 380 | created_at 381 | 17分钟前 382 | idstr 383 | 3824311863012910 384 | pic_urls 385 | 386 | 387 | thumbnail_pic 388 | http://ww1.sinaimg.cn/thumbnail/8e6cb447gw1eqi0sog1shj20c80c50ts.jpg 389 | 390 | 391 | thumbnail_pic 392 | http://ww1.sinaimg.cn/thumbnail/8e6cb447gw1eqi0soyjp8j20c80c5gme.jpg 393 | 394 | 395 | thumbnail_pic 396 | http://ww3.sinaimg.cn/thumbnail/8e6cb447gw1eqi0spkkmnj20c80c5ab2.jpg 397 | 398 | 399 | thumbnail_pic 400 | http://ww2.sinaimg.cn/thumbnail/8e6cb447gw1eqi0sq79ehj20c80c5q45.jpg 401 | 402 | 403 | thumbnail_pic 404 | http://ww2.sinaimg.cn/thumbnail/8e6cb447gw1eqi0sqtf2zj20c80c8dgl.jpg 405 | 406 | 407 | thumbnail_pic 408 | http://ww3.sinaimg.cn/thumbnail/8e6cb447gw1eqi0srhh8wj20c80c7wfn.jpg 409 | 410 | 411 | thumbnail_pic 412 | http://ww1.sinaimg.cn/thumbnail/8e6cb447gw1eqi0ss1tgbj20c80c6aay.jpg 413 | 414 | 415 | thumbnail_pic 416 | http://ww1.sinaimg.cn/thumbnail/8e6cb447gw1eqi0ssnz88j20c80c80tj.jpg 417 | 418 | 419 | thumbnail_pic 420 | http://ww1.sinaimg.cn/thumbnail/8e6cb447gw1eqi0staff2j20c80c33zv.jpg 421 | 422 | 423 | reposts_count 424 | 219 425 | source 426 | 来自微博 weibo.com 427 | text 428 | English Angora 英国安哥拉兔 🐰 🐰 🐰 [doge] 429 | user 430 | 431 | mbrank 432 | 5 433 | mbtype 434 | 12 435 | name 436 | 热头像集 437 | profile_image_url 438 | http://tp4.sinaimg.cn/2389488711/50/40065847526/0 439 | vip 440 | 441 | 442 | 443 | source 444 | 来自vivo_X5Max 445 | text 446 | [doge] 447 | user 448 | 449 | mbrank 450 | 4 451 | mbtype 452 | 12 453 | name 454 | 每日笑话百科 455 | profile_image_url 456 | http://tp4.sinaimg.cn/3884592975/50/40049419542/1 457 | vip 458 | 459 | 460 | 461 | 462 | attitudes_count 463 | 0 464 | comments_count 465 | 2 466 | created_at 467 | 3分钟前 468 | idstr 469 | 3824315365212644 470 | pic_urls 471 | 472 | reposts_count 473 | 0 474 | retweeted_status 475 | 476 | attitudes_count 477 | 18 478 | comments_count 479 | 0 480 | created_at 481 | 9小时前 482 | idstr 483 | 3824171186588107 484 | pic_urls 485 | 486 | reposts_count 487 | 6 488 | source 489 | 来自微博 weibo.com 490 | text 491 | 风水自然存在,风水作用于人生的方方面面 财运 健康 家庭 子女 等等。风水是一种改变命运的科学方法。有意识的风水调理,是以人驾驭的风水之道为前提,并以人目前阶段,对改变环境的掌控为基础,进行的环境改变。所以,风水调理并不是无限程度的,所以,风水是一门发挥积蓄潜能以改善人生的自然科学! 492 | user 493 | 494 | mbrank 495 | 6 496 | mbtype 497 | 12 498 | name 499 | 风水智语 500 | profile_image_url 501 | http://tp4.sinaimg.cn/1999969267/50/5721772871/1 502 | vip 503 | 504 | 505 | 506 | source 507 | 来自360安全浏览器 508 | text 509 | 江湖中有很多神奇的传说,可以通过风水提前看人的命运怎么怎么样,对,好像很神奇,其实都没什么。能给普通百姓创造奇迹才是厉害的,但是创造奇迹是有前提条件的。这些道理要明白。 510 | user 511 | 512 | mbrank 513 | 6 514 | mbtype 515 | 12 516 | name 517 | 风水智语 518 | profile_image_url 519 | http://tp4.sinaimg.cn/1999969267/50/5721772871/1 520 | vip 521 | 522 | 523 | 524 | 525 | attitudes_count 526 | 0 527 | comments_count 528 | 1 529 | created_at 530 | 3分钟前 531 | idstr 532 | 3824315340848207 533 | pic_urls 534 | 535 | reposts_count 536 | 0 537 | retweeted_status 538 | 539 | attitudes_count 540 | 1 541 | comments_count 542 | 12 543 | created_at 544 | 5小时前 545 | idstr 546 | 3824228350706768 547 | pic_urls 548 | 549 | 550 | thumbnail_pic 551 | http://ww3.sinaimg.cn/thumbnail/b60d4a83gw1eqhrnqtor6j20ku0hujuf.jpg 552 | 553 | 554 | reposts_count 555 | 4 556 | source 557 | 来自微博 weibo.com 558 | text 559 | 【#女屌逆袭日#】今天我会告诉你你最屌丝的行为是什么,记得告诉我你的星座,而且我会告诉你什么时候或者是做什么会逆袭哦!!!参加活动的,有机会得到旺姻缘的姻缘绳哦。[江南style]http://t.cn/RA24EHC 560 | user 561 | 562 | mbrank 563 | 6 564 | mbtype 565 | 12 566 | name 567 | 会看相的兔子 568 | profile_image_url 569 | http://tp4.sinaimg.cn/3054324355/50/5710060162/1 570 | vip 571 | 572 | 573 | 574 | source 575 | 来自微博 weibo.com 576 | text 577 | 转一次~ 578 | user 579 | 580 | mbrank 581 | 6 582 | mbtype 583 | 12 584 | name 585 | 会看相的兔子 586 | profile_image_url 587 | http://tp4.sinaimg.cn/3054324355/50/5710060162/1 588 | vip 589 | 590 | 591 | 592 | 593 | attitudes_count 594 | 28 595 | comments_count 596 | 10 597 | created_at 598 | 3分钟前 599 | idstr 600 | 3824315328092513 601 | pic_urls 602 | 603 | reposts_count 604 | 21 605 | retweeted_status 606 | 607 | attitudes_count 608 | 14 609 | comments_count 610 | 18 611 | created_at 612 | 8分钟前 613 | idstr 614 | 3824314128297813 615 | pic_urls 616 | 617 | reposts_count 618 | 96 619 | source 620 | 来自微博 weibo.com 621 | text 622 | 丧心病狂的案发现场,真是被狗日了。。。[笑cry] http://t.cn/RAAfTH3 623 | user 624 | 625 | mbrank 626 | 5 627 | mbtype 628 | 12 629 | name 630 | 我与贱客的日常 631 | profile_image_url 632 | http://tp2.sinaimg.cn/1895286921/50/40065198661/1 633 | vip 634 | 635 | 636 | 637 | source 638 | 来自微博 weibo.com 639 | text 640 | [笑cry] 641 | user 642 | 643 | mbrank 644 | 6 645 | mbtype 646 | 12 647 | name 648 | 一起神回复 649 | profile_image_url 650 | http://tp4.sinaimg.cn/1895964183/50/22873788984/1 651 | vip 652 | 653 | 654 | 655 | 656 | attitudes_count 657 | 0 658 | comments_count 659 | 0 660 | created_at 661 | 3分钟前 662 | idstr 663 | 3824315286282937 664 | pic_urls 665 | 666 | 667 | thumbnail_pic 668 | http://ww2.sinaimg.cn/thumbnail/b60d4a83gw1eqi1mqwp3yj20gv0htwfa.jpg 669 | 670 | 671 | reposts_count 672 | 0 673 | source 674 | 来自微博 weibo.com 675 | text 676 | 【#女屌逆袭日#】@Hi_6weiwei 存在感太低的女屌。换斜刘海吧。 677 | user 678 | 679 | mbrank 680 | 6 681 | mbtype 682 | 12 683 | name 684 | 会看相的兔子 685 | profile_image_url 686 | http://tp4.sinaimg.cn/3054324355/50/5710060162/1 687 | vip 688 | 689 | 690 | 691 | 692 | attitudes_count 693 | 2 694 | comments_count 695 | 1 696 | created_at 697 | 4分钟前 698 | idstr 699 | 3824315181350556 700 | pic_urls 701 | 702 | 703 | thumbnail_pic 704 | http://ww2.sinaimg.cn/thumbnail/a73d974ejw1eqi1n5nnrdj20cs09bdgw.jpg 705 | 706 | 707 | reposts_count 708 | 2 709 | source 710 | 来自朵朵塔罗在线占卜馆 711 | text 712 | 【越活越幸福的星座】冠军(双鱼座:小小愿望装满心脏,保护自己要学会健忘)、亚军(金牛座)、季军(白羊座)、第四名(射手座)、第五名(水瓶座)、第六名(双子座)、第七名(巨蟹座)、第八名(天秤座)、第九名(狮子座)、第十名(处女座)、第十一名(天蝎座)、第十二名(摩羯座)。 713 | user 714 | 715 | mbrank 716 | 6 717 | mbtype 718 | 12 719 | name 720 | 朵朵塔罗 721 | profile_image_url 722 | http://tp3.sinaimg.cn/2805831502/50/5636350254/0 723 | vip 724 | 725 | 726 | 727 | 728 | attitudes_count 729 | 8 730 | comments_count 731 | 3 732 | created_at 733 | 4分钟前 734 | idstr 735 | 3824315176457525 736 | pic_urls 737 | 738 | reposts_count 739 | 0 740 | source 741 | 来自微博树洞 742 | text 743 | 我能有什么秘密啊,哈哈哈哈,see you 拉拉 744 | user 745 | 746 | mbrank 747 | 4 748 | mbtype 749 | 12 750 | name 751 | 微博树洞 752 | profile_image_url 753 | http://tp4.sinaimg.cn/5103578591/50/22871946288/1 754 | vip 755 | 756 | 757 | 758 | 759 | attitudes_count 760 | 0 761 | comments_count 762 | 0 763 | created_at 764 | 4分钟前 765 | idstr 766 | 3824315025868162 767 | pic_urls 768 | 769 | 770 | thumbnail_pic 771 | http://ww4.sinaimg.cn/thumbnail/b60d4a83gw1eqi1m28kp8j20gy0hewfi.jpg 772 | 773 | 774 | reposts_count 775 | 0 776 | source 777 | 来自微博 weibo.com 778 | text 779 | 【#女屌逆袭日#】@穆晓玥 人际关系很一般的女屌,带木佛珠吧。 780 | user 781 | 782 | mbrank 783 | 6 784 | mbtype 785 | 12 786 | name 787 | 会看相的兔子 788 | profile_image_url 789 | http://tp4.sinaimg.cn/3054324355/50/5710060162/1 790 | vip 791 | 792 | 793 | 794 | 795 | attitudes_count 796 | 89 797 | comments_count 798 | 47 799 | created_at 800 | 4分钟前 801 | idstr 802 | 3824315017063778 803 | pic_urls 804 | 805 | 806 | thumbnail_pic 807 | http://ww2.sinaimg.cn/thumbnail/9e5389bbjw1eqi1mg2p8ej20b60fa74s.jpg 808 | 809 | 810 | reposts_count 811 | 41 812 | source 813 | 来自微博 weibo.com 814 | text 815 | 【陕西省政协原副主席祝作利涉嫌受贿 被提起公诉】近日,河北检察机关依法对陕西省政协原副主席祝作利涉嫌受贿案提起公诉。检方指控:被告人祝作利利用其担任陕西省发改委副主任、主任、陕西省政协副主席等职务便利,为他人谋取利益,非法收受他人巨额财物,应以受贿罪追究其刑事责任。(央视记者左力) 816 | user 817 | 818 | mbrank 819 | 4 820 | mbtype 821 | 12 822 | name 823 | 央视新闻 824 | profile_image_url 825 | http://tp4.sinaimg.cn/2656274875/50/5712463941/1 826 | vip 827 | 828 | 829 | 830 | 831 | attitudes_count 832 | 0 833 | comments_count 834 | 0 835 | created_at 836 | 5分钟前 837 | idstr 838 | 3824314849834129 839 | pic_urls 840 | 841 | 842 | thumbnail_pic 843 | http://ww4.sinaimg.cn/thumbnail/b60d4a83gw1eqi1l9p29ej20fl0aot90.jpg 844 | 845 | 846 | reposts_count 847 | 0 848 | source 849 | 来自微博 weibo.com 850 | text 851 | 【#女屌逆袭日#】@等待是谁都负担不起的未来_620 容易情绪化波动太多的女屌,想静心就多学禅宗。 852 | user 853 | 854 | mbrank 855 | 6 856 | mbtype 857 | 12 858 | name 859 | 会看相的兔子 860 | profile_image_url 861 | http://tp4.sinaimg.cn/3054324355/50/5710060162/1 862 | vip 863 | 864 | 865 | 866 | 867 | attitudes_count 868 | 10 869 | comments_count 870 | 0 871 | created_at 872 | 6分钟前 873 | idstr 874 | 3824314627609273 875 | pic_urls 876 | 877 | 878 | thumbnail_pic 879 | http://ww3.sinaimg.cn/thumbnail/e5fec7b1gw1ep45wq48k9j20c8085wef.jpg 880 | 881 | 882 | thumbnail_pic 883 | http://ww2.sinaimg.cn/thumbnail/e5fec7b1gw1ep45wqafz9j20c8085jrb.jpg 884 | 885 | 886 | thumbnail_pic 887 | http://ww2.sinaimg.cn/thumbnail/e5fec7b1gw1ep45wqehv8j20c80853yg.jpg 888 | 889 | 890 | thumbnail_pic 891 | http://ww1.sinaimg.cn/thumbnail/e5fec7b1gw1ep45wqkua6j20c80853yi.jpg 892 | 893 | 894 | thumbnail_pic 895 | http://ww4.sinaimg.cn/thumbnail/e5fec7b1gw1ep45wqricaj20c808574a.jpg 896 | 897 | 898 | thumbnail_pic 899 | http://ww4.sinaimg.cn/thumbnail/e5fec7b1gw1ep45wqwvujj20c8085glj.jpg 900 | 901 | 902 | thumbnail_pic 903 | http://ww4.sinaimg.cn/thumbnail/e5fec7b1gw1ep45wr5t7uj20c80853yi.jpg 904 | 905 | 906 | thumbnail_pic 907 | http://ww3.sinaimg.cn/thumbnail/e5fec7b1gw1ep45wrirksj20c8085a9y.jpg 908 | 909 | 910 | thumbnail_pic 911 | http://ww4.sinaimg.cn/thumbnail/e5fec7b1gw1ep45wrnqe9j20c8085t8u.jpg 912 | 913 | 914 | reposts_count 915 | 21 916 | source 917 | 来自即刻笔记 918 | text 919 | 通俗易懂但句句令人深思的几大定律。 920 | user 921 | 922 | mbrank 923 | 6 924 | mbtype 925 | 12 926 | name 927 | 一句话囧言囧语 928 | profile_image_url 929 | http://tp1.sinaimg.cn/1625152340/50/5619767355/1 930 | vip 931 | 932 | 933 | 934 | 935 | attitudes_count 936 | 40 937 | comments_count 938 | 11 939 | created_at 940 | 6分钟前 941 | idstr 942 | 3824314627608294 943 | pic_urls 944 | 945 | 946 | thumbnail_pic 947 | http://ww4.sinaimg.cn/thumbnail/ba8d3519jw1eqhq5sd575j20c80c8mxe.jpg 948 | 949 | 950 | thumbnail_pic 951 | http://ww1.sinaimg.cn/thumbnail/ba8d3519jw1eqhq5sjiadj20c80c80sq.jpg 952 | 953 | 954 | thumbnail_pic 955 | http://ww1.sinaimg.cn/thumbnail/ba8d3519jw1eqhq5sqz8lj20c80c8q2y.jpg 956 | 957 | 958 | thumbnail_pic 959 | http://ww4.sinaimg.cn/thumbnail/ba8d3519jw1eqhq5sxh2vj20c80c8jrj.jpg 960 | 961 | 962 | thumbnail_pic 963 | http://ww2.sinaimg.cn/thumbnail/ba8d3519jw1eqhq5t89xrj20c80c8dfx.jpg 964 | 965 | 966 | thumbnail_pic 967 | http://ww3.sinaimg.cn/thumbnail/ba8d3519jw1eqhq5td9chj20c80c8mx7.jpg 968 | 969 | 970 | thumbnail_pic 971 | http://ww1.sinaimg.cn/thumbnail/ba8d3519jw1eqhq6izks8j20c80c8jrf.jpg 972 | 973 | 974 | thumbnail_pic 975 | http://ww2.sinaimg.cn/thumbnail/ba8d3519jw1eqhq6j5r0pj20c80c8aa3.jpg 976 | 977 | 978 | thumbnail_pic 979 | http://ww1.sinaimg.cn/thumbnail/ba8d3519jw1eqhq6jozmvj20c80c8dfx.jpg 980 | 981 | 982 | reposts_count 983 | 68 984 | source 985 | 来自即刻笔记 986 | text 987 | 女生熬夜的危害,请看完,转发告诉你身边的女孩吧!!![衰] 988 | user 989 | 990 | mbrank 991 | 6 992 | mbtype 993 | 12 994 | name 995 | 嘴巴笑抽筋了 996 | profile_image_url 997 | http://tp2.sinaimg.cn/2655485361/50/40050952069/1 998 | vip 999 | 1000 | 1001 | 1002 | 1003 | total_number 1004 | 1091 1005 | 1006 | 1007 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 hare27 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /MBProgressHUD+show.h: -------------------------------------------------------------------------------- 1 | // 2 | // MBProgressHUD+show.h 3 | // rac 4 | // 5 | // Created by hare27 on 16/6/1. 6 | // Copyright © 2016年 hare27. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | @interface MBProgressHUD (show) 12 | 13 | + (void)showMessage:(NSString *)message; 14 | + (void)showSuccess:(NSString *)success; 15 | + (void)showError:(NSString *)error; 16 | + (void)hideHUD; 17 | 18 | @end 19 | -------------------------------------------------------------------------------- /MBProgressHUD+show.m: -------------------------------------------------------------------------------- 1 | // 2 | // MBProgressHUD+show.m 3 | // rac 4 | // 5 | // Created by hare27 on 16/6/1. 6 | // Copyright © 2016年 hare27. All rights reserved. 7 | // 8 | 9 | #import "MBProgressHUD+show.h" 10 | 11 | @implementation MBProgressHUD (show) 12 | 13 | + (void)showMessage:(NSString *)message{ 14 | [self hideHUD]; 15 | // 快速显示一个提示信息 16 | MBProgressHUD *hud = [self showHUDAddedTo:[self currentView] animated:YES]; 17 | hud.labelText = message; 18 | // 隐藏时候从父控件中移除 19 | hud.removeFromSuperViewOnHide = YES; 20 | // YES代表需要蒙版效果 21 | hud.dimBackground = YES; 22 | } 23 | + (void)showSuccess:(NSString *)success{ 24 | [self show:success icon:@"success.png"]; 25 | } 26 | + (void)showError:(NSString *)error{ 27 | [self show:error icon:@"error.png"]; 28 | } 29 | 30 | + (void)show:(NSString *)text icon:(NSString *)icon{ 31 | 32 | UIView *currentView = [self currentView]; 33 | 34 | [self hideHUD]; 35 | 36 | // 快速显示一个提示信息 37 | MBProgressHUD *hud = [self showHUDAddedTo:currentView animated:YES]; 38 | hud.labelText = text; 39 | // 设置图片 40 | hud.customView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:[NSString stringWithFormat:@"Show.bundle/%@", icon]]]; 41 | // 再设置模式 42 | hud.mode = MBProgressHUDModeCustomView; 43 | 44 | // 隐藏时候从父控件中移除 45 | hud.removeFromSuperViewOnHide = YES; 46 | 47 | // 1秒之后再消失 48 | [hud hide:YES afterDelay:1.2]; 49 | } 50 | 51 | + (UIView *)currentView{ 52 | 53 | return [UIApplication sharedApplication].keyWindow; 54 | } 55 | 56 | + (void)hideHUD 57 | { 58 | [self hideAllHUDsForView:[self currentView] animated:YES]; 59 | } 60 | 61 | 62 | @end 63 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # HTool --------------------------------------------------------------------------------