Using UIAppearance and switching themes

前端 未结 4 693
囚心锁ツ
囚心锁ツ 2021-01-06 05:26

I\'m looking to theme my iOS app and have been reading up on UIAppearance. I want the user to be able to switch between a number of different visual themes from within the a

4条回答
  •  梦毁少年i
    2021-01-06 05:53

    This works for me in Swift:

    let windows = UIApplication.sharedApplication().windows
    for window in windows {
        for view in window.subviews {
            view.removeFromSuperview()
            window.addSubview(view)
        }
    }
    

提交回复
热议问题