0

I'm finding a way to get the height of the rear view, I need it because I'm using this code to show and hide an activity indicator:

    func showActivityIndicator() {
    DispatchQueue.main.async {
        self.loadingView = UIView()
        self.loadingView.frame = CGRect(x: 0.0, y: 0.0, width: self.view.frame.width, height: self.view.frame.height)
        print("Width: \(self.revealViewController().view.frame.width)")
        print("Height: \(self.revealViewController().view.frame.height)")
        self.loadingView.center = self.view.center
        self.loadingView.backgroundColor = UIColor(rgba: "#111111")
        self.loadingView.alpha = 0.9
        self.loadingView.clipsToBounds = true


        self.spinner = UIActivityIndicatorView(activityIndicatorStyle: .whiteLarge)
        self.spinner.frame = CGRect(x: 0.0, y: 0.0, width: 80.0, height: 80.0)
        self.spinner.center = CGPoint(x:self.loadingView.bounds.size.width / 2, y:self.loadingView.bounds.size.height / 2)

        self.loadingView.addSubview(self.spinner)
        self.view.addSubview(self.loadingView)
        self.spinner.startAnimating()
    }
}

func hideActivityIndicator() {
    DispatchQueue.main.async {
        self.spinner.stopAnimating()
        self.loadingView.removeFromSuperview()
    }
}

But is not showing the activity on the all size of the rear view, just on the size of the device.

Here two pictures from above and below.

enter image description here enter image description here

Maybe exits another way to do it or advices that I could use to fix it.

Thank you for the help,

Snoobie
  • 760
  • 2
  • 12
  • 30

1 Answers1

0

Did you try to find some property in

self.swrevealviewcontroller.height

I use it long time ago and i remember that there is a property, im almost sure!

Hope it helps!

Lucas Palaian
  • 374
  • 2
  • 12
  • I'm using `self.revealViewController().view.frame.height` but it return the height of the device and not the height of the scroll view inside the rear view – Snoobie Jan 25 '17 at 18:58