0

I have been working on this for hours(today)/months. I just want my BG to stay permanent in all view controllers as well as the same buttons with the same commands for all of them. It is only the foreground element that is transitioning around in the center of the viewfinder, from side to side.

I tried using a subclass, it did not effect my view controller at all. When it came to trying to get my buttons to stay, i tried to cheat and use a tab bar, but the tab bar controller is locked at the bottom and I can't move it up the y axis.

Is there an easier way? Is there a way to make a view controller have the main components and every other view controller has sub components that transitions, one from another using the main components controller.

When attempting to make a subclass, I made a touch class file and put..

import UIKit

class WallpaperWindow: UIWindow {

var wallpaper: UIImage? = UIImage(named: "BG.png") {
    didSet {
        // refresh if the image changed
        setNeedsDisplay()
    }
}

init() {

    super.init(frame: UIScreen.main.bounds)
    //clear the background color of all table views, so we can see the background
    UITableView.appearance().backgroundColor = UIColor.clear
}

required init?(coder aDecoder: NSCoder) {
    super.init(coder: aDecoder)
}

override func draw(_ rect: CGRect) {
    // draw the wallper if set, otherwise default behaviour
    if let wallpaper = wallpaper {
        wallpaper.draw(in: self.bounds);
    } else {
        super.draw(rect)
    }
}

and then put

var window: UIWindow? = WallpaperWindow()

into my AppDelegate...

the code was working find, just my background did not change at all...


Related in making the tab bar move up the y axis I had no luck, it was locked....counting even tough the UIcoding..

Vi Newson
  • 1
  • 1

0 Answers0