簡體   English   中英

如何在 swift 中繞過我的應用程序 window 的角落?

[英]How do I round the corners of my app's window in swift?

我正在嘗試在 swift 中繞過我整個應用程序的 window 的角落,就像現金應用程序或篝火一樣。 我怎么做?

你可以在你的 AppDelegate class

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

如果您使用的是 SceneDelegate class 那么

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.
    }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM