Search code examples
iosswifttransformationibactioncgaffinetransform

Is it possible to scale the whole view of an app?


so I've been working on this project that involves the whole app's view to be flipped by scaling( if its even possible). I've done this before with a label but I have no idea where to start with the whole app.

I plan on pressing a button and then the whole screen flips by scaling.

here is my attempt:

@IBAction func Flip(_ sender: Any) {
    UIView.animate(withDuration: 2.0,animations: {
        self.UIView.transform = CGAffineTransform(scaleX: -1, y: 1)

As I said, I dont know where to start, but I was just wondering if it was even possible to have a whole app just flip and if so, is there any way I could get through this problem.

About Duplicate: My Previous question (that was marked as a duplicate) talks about MapBox, and how I can change the Turn-by-Turn UI, but I thought it was better off knowing how to flip the whole app because adding Navigation and Mapbox to the situation makes it a whole different story.


Solution

  • Since UIWindow inherits from UIView, you might be able to just apply a transform to it:

    // Assuming your AppDelegate has a "window" property.
    UIApplication.shared.delegate!.window!.transform = CGAffineTransform(scaleX: -1, y: 1)