Skip to content

Commit eea413f

Browse files
author
Jasper
committed
新增很多
1 parent 645d0f3 commit eea413f

File tree

46 files changed

+1500
-58
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1500
-58
lines changed

CYUtilProject/.DS_Store

0 Bytes
Binary file not shown.

CYUtilProject/CYChat/CYChatViewController.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
136136

137137
case CYChatMessageTypeVoice: {
138138

139-
cell.voiceLengthLabel.text = [NSString stringWithFormat:@"%ld\"", message.voiceLength];
139+
cell.voiceLengthLabel.text = [NSString stringWithFormat:@"%ld\"", (unsigned long)message.voiceLength];
140140
cell.unreadImageView.hidden = !(message.unread);
141141
break;
142142
}

CYUtilProject/CYExceptionUtils/CYExceptionUtils.m

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,14 @@ @interface CYExceptionUtils()
1616

1717
@implementation CYExceptionUtils
1818

19+
static NSUncaughtExceptionHandler *_originUncaughtExceptionHandler;
20+
1921
void CYUncaughtExceptionHandler(NSException *exception) {
2022

2123
CYUncaughtExceptionsHandler handler = [CYExceptionUtils sharedInstance].uncaughtExceptionHandler;
24+
if (_originUncaughtExceptionHandler) {
25+
_originUncaughtExceptionHandler(exception);
26+
}
2227
if (handler) {
2328

2429
handler(exception);
@@ -31,6 +36,7 @@ + (void)registerUncaughtExceptionsHandler:(CYUncaughtExceptionsHandler)handler {
3136

3237
static dispatch_once_t onceToken;
3338
dispatch_once(&onceToken, ^{
39+
_originUncaughtExceptionHandler = NSGetUncaughtExceptionHandler();
3440

3541
NSSetUncaughtExceptionHandler(&CYUncaughtExceptionHandler);
3642
});

CYUtilProject/CYFoundationUtils/NSArray+CYJson.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
automically:(BOOL)useAuxiliaryFile;
2424

2525
- (BOOL)cy_writeToFileAsJson:(NSString *)filePath
26-
atomically:(BOOL)useAuxiliaryFile
26+
automically:(BOOL)useAuxiliaryFile
2727
error:(NSError **)error;
2828

2929
@end

CYUtilProject/CYFoundationUtils/NSArray+CYJson.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ + (NSArray *)cy_arrayFromJsonData:(NSData *)jsonData {
6969
- (BOOL)cy_writeToFileAsJson:(NSString *)filePath automically:(BOOL)useAuxiliaryFile {
7070

7171
return [self cy_writeToFileAsJson:filePath
72-
atomically:useAuxiliaryFile
72+
automically:useAuxiliaryFile
7373
error:nil];
7474
}
7575

76-
- (BOOL)cy_writeToFileAsJson:(NSString *)filePath atomically:(BOOL)useAuxiliaryFile error:(NSError **)error {
76+
- (BOOL)cy_writeToFileAsJson:(NSString *)filePath automically:(BOOL)useAuxiliaryFile error:(NSError **)error {
7777

7878
if (!filePath) {
7979

CYUtilProject/CYFoundationUtils/NSDictionary+CYJson.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
- (BOOL)cy_writeToFileAsJson:(NSString *)filePath
2323
automically:(BOOL)useAuxiliaryFile;
2424
- (BOOL)cy_writeToFileAsJson:(NSString *)filePath
25-
atomically:(BOOL)useAuxiliaryFile
25+
automically:(BOOL)useAuxiliaryFile
2626
error:(NSError **)error;
2727

2828
@end

CYUtilProject/CYFoundationUtils/NSDictionary+CYJson.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,12 +75,12 @@ + (NSDictionary *)cy_dictionaryFromJsonData:(NSData *)jsonData {
7575
- (BOOL)cy_writeToFileAsJson:(NSString *)filePath automically:(BOOL)useAuxiliaryFile {
7676

7777
return [self cy_writeToFileAsJson:filePath
78-
atomically:useAuxiliaryFile
78+
automically:useAuxiliaryFile
7979
error:nil];
8080
}
8181

8282
- (BOOL)cy_writeToFileAsJson:(NSString *)filePath
83-
atomically:(BOOL)useAuxiliaryFile
83+
automically:(BOOL)useAuxiliaryFile
8484
error:(NSError **)error {
8585

8686
if (!filePath) {

CYUtilProject/CYSegmented/CYPlainSegmentedView.m

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ @interface CYPlainSegmentedView ()
1919

2020
@implementation CYPlainSegmentedView
2121

22-
static const NSInteger badgeDefaultTag = 57363;
23-
2422
static const NSInteger segmentedItemStartTag = 12313;
2523

2624
- (instancetype)initWithFrame:(CGRect)frame {
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// UIView.h
3+
// CYUtilProject
4+
//
5+
// Created by xn011644 on 22/08/2017.
6+
// Copyright © 2017 Charry. All rights reserved.
7+
//
8+
9+
#import <UIKit/UIKit.h>
10+
11+
typedef void (^CYAnimatableProgress)(CGFloat progress);
12+
typedef void (^CYAnimatableCompletion)(BOOL finished);
13+
14+
@interface UIView (Animatable) <CALayerDelegate, CAAnimationDelegate>
15+
16+
@end
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
//
2+
// UIView.m
3+
// CYUtilProject
4+
//
5+
// Created by xn011644 on 22/08/2017.
6+
// Copyright © 2017 Charry. All rights reserved.
7+
//
8+
9+
#import "UIView+Animatable.h"
10+
11+
@interface CYViewAnimationLayer : CALayer
12+
13+
@property (nonatomic, assign) CGFloat animationProperty;
14+
@property (nonatomic, assign) CGFloat animationDuration;
15+
@property (nonatomic, strong) CAMediaTimingFunction *timingFunction;
16+
17+
@property (nonatomic, copy, readonly) CYAnimatableProgress progressBlock;
18+
@property (nonatomic, copy, readonly) CYAnimatableCompletion completionBlock;
19+
20+
@end
21+
22+
@implementation CYViewAnimationLayer
23+
24+
- (instancetype)initWithProgress:(CYAnimatableProgress)progress
25+
completion:(CYAnimatableCompletion)completion {
26+
if (self = [super init]) {
27+
28+
_progressBlock = progress;
29+
_completionBlock = completion;
30+
31+
self.opaque = NO;
32+
}
33+
return self;
34+
}
35+
36+
@end
37+
38+
@implementation UIView (Animatable)
39+
40+
static NSString *const animationLayerName = @"__animationLayerName__";
41+
static NSString *const animationLayerEvent = @"animationProperty";
42+
43+
- (void)startAnimationWithProgress:(CYAnimatableProgress)progressBlock
44+
completion:(CYAnimatableCompletion)completionBlock {
45+
46+
CYViewAnimationLayer *animationLayer = nil;
47+
if (!animationLayer) {
48+
animationLayer = [[CYViewAnimationLayer alloc] initWithProgress:progressBlock
49+
completion:completionBlock];
50+
animationLayer.delegate = self;
51+
animationLayer.name = animationLayerName;
52+
animationLayer.opaque = NO;
53+
[self.layer addSublayer:animationLayer];
54+
}
55+
}
56+
57+
#pragma mark - CALayerDelegate
58+
- (id<CAAction>)actionForLayer:(CALayer *)layer forKey:(NSString *)event {
59+
60+
if ([layer.name isEqualToString:animationLayerName]
61+
&& [event isEqualToString:animationLayerEvent]) {
62+
CYViewAnimationLayer *animationLayer = (CYViewAnimationLayer *)layer;
63+
64+
CABasicAnimation *animation = [CABasicAnimation animation];
65+
animation.fromValue = @0;
66+
animation.duration = animationLayer.duration;
67+
animation.timingFunction = animationLayer.timingFunction;
68+
animation.delegate = self;
69+
return animation;
70+
}
71+
return nil;
72+
}
73+
74+
- (void)displayLayer:(CALayer *)layer {
75+
76+
if ([layer.name isEqualToString:animationLayerName]) {
77+
78+
CYViewAnimationLayer *animationLayer = (CYViewAnimationLayer *)layer;
79+
CYViewAnimationLayer *presentationLayer = animationLayer.presentationLayer;
80+
if (animationLayer.animationProperty != 0
81+
&& animationLayer.progressBlock) {
82+
83+
animationLayer.progressBlock(presentationLayer.animationProperty / animationLayer.animationProperty);
84+
}
85+
}
86+
87+
}
88+
89+
#pragma mark - CAAnimationDelegate
90+
- (void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag {
91+
92+
93+
}
94+
95+
@end

0 commit comments

Comments
 (0)