【问题标题】:How do I round the corners of my app's window in swift?如何快速绕过我的应用程序窗口的角落?
【发布时间】:2020-08-15 08:42:44
【问题描述】:

我正在尝试快速绕过整个应用程序窗口的角落,例如现金应用程序或篝火。我该怎么做?

【问题讨论】:

    标签: ios swift xcode uikit calayer


    【解决方案1】:

    你可以在你的 AppDelegate 类中做到这一点

    func applicationDidBecomeActive(_ application: UIApplication) {
        window?.layer.cornerRadius = 10
        window?.clipsToBounds = true
        window?.backgroundColor = .white
      }
    

    如果你使用的是 SceneDelegate 类,那么

    func sceneDidBecomeActive(_ scene: UIScene) {
    
    
              window?.layer.cornerRadius = 110
              window?.clipsToBounds = true
              window?.backgroundColor = UIColor.black
    
            // Called when the scene has moved from an inactive state to an active state.
            // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
        }
    

    【讨论】:

      猜你喜欢
      • 2018-07-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-27
      • 2018-05-12
      • 2016-10-19
      • 2016-09-19
      相关资源
      最近更新 更多