This file contains hidden or 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
// | |
// TableViewController.m | |
// 多图下载 | |
// | |
#import "TableViewController.h" | |
#import "KMCGeigerCounter.h" | |
#import "CellData.h" | |
@interface TableViewController () |
This file contains hidden or 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
//延迟执行任务函数dispatch_after | |
-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event{ | |
NSLog(@"start"); | |
//dispatch_after 是异步执行的 | |
//队列只决定在哪个线程中执行任务 并不能决定执行时间 | |
/** | |
* 第一个参数: 在哪个时间点执行 | |
* dispatch_time(从哪个时间点开始,经历多少纳秒) | |
* 第二个参数: 在哪个队列中执行block任务 | |
* 第三个参数: block任务 |
This file contains hidden or 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
//1.在每次点击时先取消之前的操作 | |
- (void)buttonClicked:(id)sender | |
{ | |
//这里是关键,点击按钮后先取消之前的操作,再进行需要进行的操作 | |
[[self class] cancelPreviousPerformRequestsWithTarget:self selector:@selector(buttonClicked:) object:sender]; | |
[self performSelector:@selector(buttonClicked: )withObject:sender afterDelay:0.2f]; | |
} | |
//2.点击后将按钮置为不可点击状态,几秒后恢复 | |
-(void)buttonClicked:(id)sender{ | |
self.button.enabled = NO; |
This file contains hidden or 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
// 状态栏(statusbar) | |
CGRect rectStatus = [[UIApplication sharedApplication] statusBarFrame]; | |
NSLog(@"status width - %f", rectStatus.size.width); // 宽度 | |
NSLog(@"status height - %f", rectStatus.size.height); // 高度 | |
// 导航栏(navigationbar) | |
CGRect rectNav = self.navigationController.navigationBar.frame; | |
NSLog(@"nav width - %f", rectNav.size.width); // 宽度 | |
NSLog(@"nav height - %f", rectNav.size.height); // 高度 |
This file contains hidden or 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
<style> | |
.tips_layer_wrap { | |
position: absolute; | |
top: 0; | |
left: 0; | |
width: 100%; | |
height: 100%; | |
background: rgba(0, 0, 0, .7); | |
z-index: 10000; | |
} |
This file contains hidden or 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
- (NSArray *)datas { | |
if (_datas == nil) { | |
NSMutableArray *temp = [NSMutableArray array]; | |
NSString *path = [[NSBundle mainBundle] pathForResource:@"apps.plist" ofType:nil]; | |
NSArray *arr = [NSArray arrayWithContentsOfFile:path]; | |
for (NSDictionary *dict in arr) { | |
CellData *data = [CellData dataWithDict:dict]; | |
[temp addObject:data]; | |
} |
This file contains hidden or 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
//预加载 jQuery版本 | |
!(function() { | |
var preloader = function(opts) { | |
var _this = this; | |
_this.files = opts.files; | |
_this.current = 0; | |
_this.progress = opts.progress; | |
_this.complete = opts.complete; | |
_this.container = document.createElement("div"); | |
_this.container.style.cssText = "position:absolute;left:-1000px;top:0;width:1px;height:1px;overflow:hidden"; |
This file contains hidden or 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
//1.创建url | |
NSString *urlStr=@"https://github.com/cnbin/insertDemo/archive/master.zip"; | |
urlStr =[urlStr stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; | |
NSURL *url=[NSURL URLWithString:urlStr]; | |
//2.创建请求 | |
NSMutableURLRequest *request=[NSMutableURLRequest requestWithURL:url]; | |
//3.创建会话(这里使用了一个全局会话)并且启动任务 | |
NSURLSession *session=[NSURLSession sharedSession]; |
This file contains hidden or 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
<!DOCTYPE html> | |
<html xmlns="http://www.w3.org/1999/xhtml"> | |
<head> | |
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> | |
<title>居中分页DIV CSS DIVCSS5在线案例演示</title> | |
<style> | |
a { | |
text-decoration: none | |
} |
This file contains hidden or 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
- (void)animationBaseTest { | |
CABasicAnimation *baseAnimate = [CABasicAnimation animationWithKeyPath:@"transform.scale"]; | |
baseAnimate.toValue = @(0); | |
baseAnimate.duration = 0.8; | |
baseAnimate.repeatCount = MAXFLOAT; | |
baseAnimate.autoreverses = YES; | |
[self.heart.layer addAnimation:baseAnimate forKey:@"scaleAnimate"]; | |