早上地铁的时间就看了这一篇文章《方舟编译器的荣光和使命》,总结一下:
安卓的四大问题
1;java虚拟机+编译器+解释器,应用安装或者空闲编译,在手机上生成二进制的机器码
2;额外的JNI开销,用于和C/C++代码交互,
3;代码优化空间有限,为了防止生态过于碎片化,为第三方开放了简单的优化
早上地铁的时间就看了这一篇文章《方舟编译器的荣光和使命》,总结一下:
安卓的四大问题
1;java虚拟机+编译器+解释器,应用安装或者空闲编译,在手机上生成二进制的机器码
2;额外的JNI开销,用于和C/C++代码交互,
3;代码优化空间有限,为了防止生态过于碎片化,为第三方开放了简单的优化
UIButton category | |
-----------------------------------------.h | |
// 定义一个枚举(包含了四种类型的button) | |
typedef NS_ENUM(NSUInteger, GLButtonEdgeInsetsStyle) { | |
GLButtonEdgeInsetsStyleTop, // image在上,label在下 | |
GLButtonEdgeInsetsStyleLeft, // image在左,label在右 | |
GLButtonEdgeInsetsStyleBottom, // image在下,label在上 | |
GLButtonEdgeInsetsStyleRight // image在右,label在左 | |
}; |
#import <CommonCrypto/CommonDigest.h> | |
#import <CommonCrypto/CommonHMAC.h> | |
#import "NSString+Hash.h" | |
NSString *username = @"quxueabc"; | |
NSString *accessKey = @"k3on19kusewub1swa2u"; | |
NSString *secretKey = @"3z1nhvcngrdk8xlrnor"; | |
NSDateFormatter *df = [[NSDateFormatter alloc] init]; | |
df.locale = [NSLocale localeWithLocaleIdentifier:@"en-us"]; |
UIImageView *lastIV = nil; | |
self.ivArrM = [NSMutableArray array]; | |
for (NSInteger i = 0; i < 4; i++) { | |
UIImageView *iv = [[UIImageView alloc] init]; | |
[self addSubview:iv]; | |
[iv mas_makeConstraints:^(MASConstraintMaker *make) { | |
if (isPad) { | |
make.width.mas_equalTo(163); | |
}else{ | |
make.width.equalTo(self).multipliedBy(0.5).offset(-IVMragin16 * 1.5); |
//1.开辟新的内存空间 | |
NSArray *originalArr = @[@1, @2, @3, @1, @3]; | |
NSMutableArray *resultArrM = [NSMutableArray array]; | |
for (NSString *item in originalArr) { | |
if (![resultArrM containsObject:item]) { | |
[resultArrM addObject:item]; | |
} | |
} |
+(void)writefile:(NSString *)string fileName:(NSString *)fileName{ | |
NSLog(@"fileName==%@",fileName); | |
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES); | |
NSString *homePath = [paths objectAtIndex:0]; | |
NSString *filePath = [homePath stringByAppendingPathComponent:fileName]; | |
NSFileManager *fileManager = [NSFileManager defaultManager]; | |
//如果不存在 | |
if(![fileManager fileExistsAtPath:filePath]){ |
- (void)SRWebSocketDidOpen { | |
NSLog(@"开启成功"); | |
//在成功后需要做的操作。。。 | |
NSDictionary *dict = @{ | |
@"ref_text": @"sunny", | |
@"audio_format": @{ | |
@"type": @"WAV", | |
@"audio_channel": @(1), | |
@"sample_rate": @(16000) |
https://ioscaff.com/articles/262?order_by=created_at& | |
//WebImage 框架为 NSData 实现了个分类来判断二进制文件图片格式 | |
+ (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data { | |
if (!data) { | |
return SDImageFormatUndefined; | |
} | |
// File signatures table: http://www.garykessler.net/library/file_sigs.html |
TSStemLabel *stem = [[TSStemLabel alloc] init]; | |
stem.numberOfLines = 0; | |
stem.text = @" $$CCTV$$ reported that every year Chinese people throw away a lot of food. Luckily, a number of people have realized the importance of saving food. {Last November}, Li Hong, a waitress in a restaurant in $$Nanjing$$, lost her job because she took some leftover food home for her son. Many people stood by her side.@What should we do in our daily life to waste less food? Here are two tips:@1. Don’t order too much food. If you can’t eat all the food you order, take the rest of it home.@2. Don’t keep too much food at home, especially for {vegetables} and fruit.In my opinion, everybody must save food."; | |
CGFloat height = stem.stemHeight; | |
[self addSubview:stem]; | |
[stem mas_makeConstraints:^(MASConstraintMaker *make) { | |
make.left.equalTo(self).offset(LRMragin); | |
make.right.equalTo(self).offset(-LRMragin); | |
make.height.mas_equalTo(height); | |
make.top.equalTo(self).offset(35); |
.h文件中 | |
@interface DemoModel : NSObject<NSCopying,NSMutableCopying> | |
@property (nonatomic,assign) NSInteger age; | |
@property (nonatomic, copy) NSString * name; | |
.m文件中 实现copyWithZone mutableCopyWithZone 方法 |