I have a viewcontroller inheriting ASDKViewController
, the background is set to a picture, when I switch tabs, the picture flashes,how can i fix it?
in SceneDelegate
:
func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
guard let windowScene = (scene as? UIWindowScene) else { return }
window = UIWindow(frame: UIScreen.main.bounds)
window?.windowScene = windowScene
let tab = UITabBarController()
let vc1 = ViewController()
vc1.title = "vc1"
let vc2 = TestViewController()
vc2.title = "vc2"
tab.viewControllers = [vc1,vc2]
window?.rootViewController = tab
window?.makeKeyAndVisible()
}
in ViewController
:
class ViewController: ASDKViewController<ASDisplayNode> {
override init() {
let bgImageView = ASImageNode()
bgImageView.image = UIImage(named: "backBg")
bgImageView.isUserInteractionEnabled = true
super.init(node: bgImageView)
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func viewDidLoad() {
super.viewDidLoad()
}
Ok, so the solution will be:
let bgImageView = ASImageNode()
bgImageView.displaysAsynchronously = false