Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When screen rotation ReloadData()

I can not update my custom view when you turn the screen of my device.

I tried to do this:

override func viewDidLoad() {
        super.viewDidLoad()


       var myCustomView = Customview()

       self.view.addsubview(myCustomView)
        }
    }

    override func didRotateFromInterfaceOrientation(fromInterfaceOrientation: UIInterfaceOrientation) {

        // Reload Data here

        self.view.reloadData() // Incorrect

    }

But get me error:

the method "UIView" does not have a method called reloadData

like image 440
Paul Avatar asked May 27 '26 08:05

Paul


1 Answers

override func didRotateFromInterfaceOrientation(fromInterfaceOrientation: UIInterfaceOrientation) {

    // Reload Data here

    self.view.reloadData() // Incorrect

}

UIView is not a UITableView it doesn't have reloadData method out of the box.

You can implement this method manually -> have fun :)

like image 88
Roma-MT Avatar answered May 30 '26 02:05

Roma-MT



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!