-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
【ADD】'UIDevice+LYHardware'添加获取运营商功能
- Loading branch information
吴浪
committed
Dec 13, 2018
1 parent
5fe4150
commit 2ab2375
Showing
13 changed files
with
597 additions
and
409 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
1 change: 1 addition & 0 deletions
1
Example/Pods/Target Support Files/LYToolsKit/LYToolsKit-umbrella.h
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
// | ||
// NSString+LYCoding.h | ||
// 茗玥古城 | ||
// | ||
// Created by 似水灵修 on 13-11-11. | ||
// Copyright (c) 2013年 MingYueGuCheng. All rights reserved. | ||
// | ||
#import <Foundation/Foundation.h> | ||
NS_ASSUME_NONNULL_BEGIN | ||
/** | ||
* 终端测试指令 | ||
* | ||
* BASE64编码(abc) | ||
* $ echo -n abc | base64 | ||
* | ||
* BASE64解码(YWJj,abc的编码) | ||
* $ echo -n YWJj | base64 -D | ||
*/ | ||
@interface NSString(LYBase64) | ||
|
||
- (instancetype)ly_base64Encode; | ||
- (instancetype)ly_base64Decode; | ||
|
||
@end | ||
|
||
/** | ||
* 终端测试指令 | ||
* 加密abc字符串: | ||
* MD5: | ||
* $ echo -n abc | openssl md5 | ||
* SHA1: | ||
* $ echo -n abc | openssl sha1 | ||
* SHA256: | ||
* $ echo -n abc | openssl sha -sha256 | ||
* SHA512: | ||
* $ echo -n abc | openssl sha -sha512 | ||
*/ | ||
@interface NSString(LYHash) | ||
|
||
- (instancetype)ly_md5String; | ||
- (instancetype)ly_sha1String; | ||
- (instancetype)ly_sha256String; | ||
- (instancetype)ly_sha512String; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
// | ||
// NSString+LYCoding.m | ||
// 茗玥古城 | ||
// | ||
// Created by 似水灵修 on 13-11-11. | ||
// Copyright (c) 2013年 MingYueGuCheng. All rights reserved. | ||
// | ||
#import "NSString+LYCoding.h" | ||
#import <CommonCrypto/CommonDigest.h> | ||
|
||
@implementation NSString(LYBase64) | ||
|
||
- (instancetype)ly_base64Encode { | ||
NSData *data = [self dataUsingEncoding:NSUTF8StringEncoding]; | ||
return [data base64EncodedStringWithOptions:0]; | ||
} | ||
|
||
- (instancetype)ly_base64Decode { | ||
NSData *data = [[NSData alloc] initWithBase64EncodedString:self options:0]; | ||
return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; | ||
} | ||
|
||
@end | ||
|
||
@implementation NSString(LYHash) | ||
|
||
- (instancetype)ly_md5String { | ||
const char *str = self.UTF8String; | ||
int length = (int)strlen(str); | ||
unsigned char bytes[CC_MD5_DIGEST_LENGTH]; | ||
CC_MD5(str, length, bytes); | ||
|
||
return [self ly_stringFromBytes:bytes length:CC_MD5_DIGEST_LENGTH]; | ||
} | ||
|
||
- (instancetype)ly_sha1String { | ||
const char *str = self.UTF8String; | ||
int length = (int)strlen(str); | ||
unsigned char bytes[CC_SHA1_DIGEST_LENGTH]; | ||
CC_SHA1(str, length, bytes); | ||
|
||
return [self ly_stringFromBytes:bytes length:CC_SHA1_DIGEST_LENGTH]; | ||
} | ||
|
||
- (instancetype)ly_sha256String { | ||
const char *str = self.UTF8String; | ||
int length = (int)strlen(str); | ||
unsigned char bytes[CC_SHA256_DIGEST_LENGTH]; | ||
CC_SHA256(str, length, bytes); | ||
|
||
return [self ly_stringFromBytes:bytes length:CC_SHA256_DIGEST_LENGTH]; | ||
} | ||
|
||
- (instancetype)ly_sha512String { | ||
const char *str = self.UTF8String; | ||
int length = (int)strlen(str); | ||
unsigned char bytes[CC_SHA512_DIGEST_LENGTH]; | ||
CC_SHA512(str, length, bytes); | ||
|
||
return [self ly_stringFromBytes:bytes length:CC_SHA512_DIGEST_LENGTH]; | ||
} | ||
|
||
- (NSString *)ly_stringFromBytes:(unsigned char *)bytes length:(int)length { | ||
NSMutableString *strM = [NSMutableString string]; | ||
|
||
for (int i = 0; i < length; i++) { | ||
[strM appendFormat:@"%02x", bytes[i]]; | ||
} | ||
|
||
return [strM copy]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// | ||
// UIBarButtonItem+LYExt.h | ||
// 茗玥古城 | ||
// | ||
// Created by 似水灵修 on 13-11-11. | ||
// Copyright (c) 2013年 MingYueGuCheng. All rights reserved. | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface UIBarButtonItem (LYExt) | ||
/** | ||
快速创建 | ||
@param nImageName 普通状态图片 | ||
@param hImageName 高亮状态图片 | ||
@param target 回调对象 | ||
@param action 回调方法 | ||
@return 返回BarButtonItem对象 | ||
*/ | ||
+ (UIBarButtonItem *)ly_itemWithNormalImageName:(NSString *)nImageName | ||
highImageName:(NSString *)hImageName | ||
target:(id)target | ||
action:(SEL)action; | ||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// | ||
// UIBarButtonItem+Item.m | ||
// 茗玥古城 | ||
// | ||
// Created by 似水灵修 on 13-11-11. | ||
// Copyright (c) 2013年 MingYueGuCheng. All rights reserved. | ||
// | ||
|
||
#import "UIBarButtonItem+LYExt.h" | ||
|
||
@implementation UIBarButtonItem (LYExt) | ||
|
||
/** | ||
* 设置导航栏按钮 | ||
* | ||
* @param nImageName 普通状态图片 | ||
* @param hImageName 高亮状态图片 | ||
* @param action 响应事件 | ||
*/ | ||
+ (UIBarButtonItem *)ly_itemWithNormalImageName:(NSString *)nImageName highImageName:(NSString *)hImageName target:(id)target action:(SEL)action { | ||
UIImage *nImage = nImageName.length ? [UIImage imageNamed:nImageName] : nil; | ||
UIImage *hImage = hImageName.length ? [UIImage imageNamed:hImageName] : nil; | ||
|
||
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom]; | ||
[btn setBackgroundImage:nImage forState:UIControlStateNormal]; | ||
[btn setBackgroundImage:hImage forState:UIControlStateHighlighted]; | ||
[btn addTarget:target action:action forControlEvents:UIControlEventTouchUpInside]; | ||
return [[UIBarButtonItem alloc] initWithCustomView:btn]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters