Skip to content

Instantly share code, notes, and snippets.

View chance395's full-sized avatar
🎯
Focusing

liang.li chance395

🎯
Focusing
View GitHub Profile
@chance395
chance395 / wkwebView的坑
Created March 13, 2019 09:21
#ios->平常小记
wkwebView可以加载百度等网址,但是不能加载http格式的网址 在plist文件中加入
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
@chance395
chance395 / runtime
Created March 9, 2019 08:50
#ios中runtime的使用
adfa
@chance395
chance395 / ios中block使用
Last active March 9, 2019 08:51
#ios_block
1.表达方式
申明: (返回值类型)(^block名)(参数列表);
变量形式: ^(形参列表){
codes...
}
tydef: typedef (返回值类型)(^block名)(参数列表);
函数中:
//对self.belongarryDevice降序
NSArray *sortDesc = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"moneyAmount" ascending:NO]];
[self.belongarryDevice sortUsingDescriptors:sortDesc];
@chance395
chance395 / 多线程GCD_semaphore
Last active March 8, 2019 08:23
#ios->多线程
@property (nonatomic, strong) void (^dispath_queueNoParaCompletion)(void);
@property (nonatomic, strong) void (^dispath_queueCompletion)(dispatch_semaphore_t semaphore);
+(void)callSemaphoreSyncQueueUseConcurrentStr:(char*)constChar WithCompletionBlock:(void(^)(dispatch_semaphore_t semaphore))completionBlock
{
if (completionBlock) {
self.dispath_queueCompletion = completionBlock;
}
dispatch_queue_t queue = dispatch_queue_create(constChar, DISPATCH_QUEUE_CONCURRENT);
dispatch_async(queue, ^{