开发随笔

sleep  usleep

两个函数都是挂起进程。 如果 挂起的时间 >= 1s 用sleep ,如果小于1s 就用usleep

这样充分利用CPU 。 

sleep(2) 就是休息2秒 

usleep(2)  休息2微秒数。  

1秒(s) = 1000 毫秒(ms) = 1,000,000 微秒(μs) = 1,000,000,000 纳秒(ns) ;

开发随笔_第1张图片
label数字从1跑到100的时间

valueForKeyPath 的用法  链接

请求网络一定要验证返回值的合法性


```

The “Swift Language Version” (SWIFT_VERSION) build setting must be set to a supported value for targets which use Swift. Supported values are: 3.0, 4.0, 4.2. This setting can be set in the build settings editor.

```

出现这个原因是 ,因为项目使用了Cocopods,项目是用低版本的Swfit 开发,在Xcode 升级后继续开发,这时导入新的库是依赖高版本的Swift。Cocopods 引入的库都会有一个Swift版本。

``` 

post_installdo|installer|

  installer.pods_project.targets.eachdo|target|

    target.build_configurations.eachdo|config|

      config.build_settings['SWIFT_VERSION'] ='4.0'

    end

  end

  end

// 这就话的意思限定每个Pod都是在4.0下编译

```

```

//modal 出一个背景透明的VC 

UIViewController *vc = [UIViewControlller alloc] init];

vc.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;   

  vc.modalPresentationStyle = UIModalPresentationOverFullScreen;

vc.view.backgroundColor = [UIColor clearColor];


```

你可能感兴趣的:(开发随笔)