zoukankan      html  css  js  c++  java
  • 十月第四周

    # 十月第四周
    1.Swift的map:

    ```
    potStructs.map { PotMaterial($0) }
    ```
    https://www.cnblogs.com/muzijie/p/6542650.html

    2.Swift Precondition 预处理:
    https://www.cnblogs.com/QianChia/p/8673714.html

    3.iOS 优化ipa包,减小安装包大小:
    https://www.jianshu.com/p/a49d59b01669

    https://www.jianshu.com/p/a72d03e92c80

    4.设置页面横竖屏:

    ```
    class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    // 页面的横竖屏 当前界面支持的方向(默认情况下只能竖屏,不能横屏显示)
    var interfaceOrientations: UIInterfaceOrientationMask = .portrait {
    didSet {
    // 强制设置成竖屏
    if interfaceOrientations == .portrait {
    UIDevice.current.setValue(UIDeviceOrientation.portrait.rawValue, forKey: "orientation")
    }
    // 强制设置成横屏
    else if !interfaceOrientations.contains(.portrait) {
    UIDevice.current.setValue(UIDeviceOrientation.landscapeLeft.rawValue, forKey: "orientation")
    }
    }
    }

    func application(_ application: UIApplication, supportedInterfaceOrientationsFor window: UIWindow?) -> UIInterfaceOrientationMask {
    return interfaceOrientations
    }

    // 使用
    class DetailViewController1: UIViewController {

    // Applegate对象
    let appDelegate = UIApplication.shared.delegate as! AppDelegate
    override func viewDidLoad() {
    super.viewDidLoad()
    view.backgroundColor = UIColor.white
    setupUI()
    }

    override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    // 该页面横竖屏切换
    appDelegate.interfaceOrientations = .allButUpsideDown
    }

    override func viewWillDisappear(_ animated: Bool) {
    // 退出页面强制竖屏
    appDelegate.interfaceOrientations = .portrait
    }
    ```
    5.didMoveToSuperView和didMoveToWindow的调用顺序:
    didMoveToSuperView -> viewWillAppear -> didMoveToWindow -> viewDidAppear

    6.正确使用可选类型:
    https://www.jianshu.com/p/448cf4f8cf65

    7.Git正确使用分支:
    不需要每次都重新拉取创建新分支,新功能才需要创建新分支。
    功能分支合到主分支要及时的删除无用的分支,以免分支太多影响管理。

    8.获取UUID:

    ```
    let UUID:String = ASIdentifierManager.shared().advertisingIdentifier.uuidString

    ```
    9.属性.classForCoder:
    编码器快捷类。

    ```
    print(self.view.classForCoder)
    ```
    输出:UIView

  • 相关阅读:
    Mybatis—动态sql拼接问题
    小白用Mac
    JSP总结(jsp/EL表达式/核心标签)
    Spring定时任务配置
    通过简单示例来理解什么是机器学习
    在jupyter notebook中同时安装python2和python3
    Python读取和处理文件后缀为".sqlite"的数据文件
    Python:Anaconda安装虚拟环境到指定路径
    TIOBE:全球编程语言最新排名(Kotlin排名进入前50名)
    Python:一篇文章掌握Numpy的基本用法
  • 原文地址:https://www.cnblogs.com/pengsi/p/9858744.html
Copyright © 2011-2022 走看看