一、唱片旋转效果(360°无限顺时针旋转)

    func animationRotateCover() {
coverImageView.layer.removeAllAnimations() let animation = CABasicAnimation(keyPath: "transform.rotation")
animation.fromValue =
animation.toValue = CGFloat.pi *
animation.duration =
animation.isCumulative = true
animation.repeatCount = Float.infinity
coverImageView.layer.add(animation, forKey: nil)
}

  二、防止文件被 iCloud 同步备份

    NSURLIsExcludedFromBackupKey

  三、禁止 UICollectionView reload/insert 动画

      UIView.performWithoutAnimation {
self.videoPartCollectionView.reloadData()
}

  四、Objective-C 中的 performSelector 在 Swift 里变成了 sendAction

    var rightTappedSelector: Selector?

    @IBAction func rightTappedAction(_ sender: Any) {
guard let selector = rightTappedSelector else {
return
}
rightButton.sendAction(selector, to: nil, for: nil)
}

  五、获得 CGAffineTransform 的 rotation 信息

extension CGAffineTransform {

    func getTransformRotation() -> CGFloat {
return atan2(self.b, self.a) * / CGFloat.pi
} }

  六、获取 Date 的 nano 时间

extension Date {

    func nanosecond() -> Int64 {
let nanosecond: Int64 = Int64(Calendar.current.dateComponents([.nanosecond], from: self).nanosecond ?? )
return Int64(self.timeIntervalSince1970 * ) + nanosecond
} }

  七、AVCapturePhotoOutput.capturePhoto 崩溃的问题

    不要让 UIViewController 实现 AVCapturePhotoCaptureDelegate ,要跟 AVCam 例子一样弄一个 class PhotoCaptureDelegate: NSObject, AVCapturePhotoCaptureDelegate 就不崩溃了,什么鬼问题

最新文章

  1. SAP中需要记住的一些标准表
  2. [转]大白话系列之C#委托与事件讲解(三)
  3. ie8下table的colspan属性与max-with属性的显示错乱问题
  4. Java实战之02Hibernate-05检索策略、检索方式
  5. C#多态联系之虚方法
  6. nodejs项目中的路由写法
  7. Singleton Pattern(单例模式)
  8. Apache shiro的简单介绍与使用(与spring整合使用)
  9. Swift:Foundation框架中的NS前缀的由来
  10. 解锁 vmware esxi 6.7 并安装 mac os 10.13
  11. tarjan求双联通分量(割点,割边)
  12. python 在列表,元组,字典变量前加*号
  13. Unity 通过代码简单实现文理的灰化显示
  14. 【Cf #291 B】R2D2 and Droid Army(二分,线段树)
  15. “全栈2019”Java异常第十一章:重写方法时只能抛出父类异常子集
  16. Failed to lookup view 'error'
  17. Makefile之写demo时的通用Makefile写法
  18. MPAndroidChart Wiki(译文)~Part 4
  19. leetcode680
  20. BAT-Java必考面试题集

热门文章

  1. -1-0 Java 简介 java是什么 java简单介绍
  2. Django 系列博客(十二)
  3. Scala(四) —— 集合
  4. Linux下如何查看版本
  5. 【微服务No.2】polly微服务故障处理库
  6. Html和Css学习笔记-css进阶-盒模型
  7. 简单实现弹出弹框页面背景半透明灰,弹框内容可滚动原页面内容不可滚动的效果(JQuery)
  8. Python常用模块:datetime
  9. python(day16)内置函数,匿名函数
  10. MTK Android O1平台预置apk