Displaying Rectangles on External Screen

100 Views Asked by At

I already have labels displaying on my externals screen but I want to add a blue rectangle of Width: 500px and Height: 50px.

What would be the code to add this?

This is the code I use for my Label.

var secondWindow: UIWindow!
var secondScreenView: UIView!

@objc func setupScreen(){
    if UIScreen.screens.count > 1{
        let secondScreen = UIScreen.screens[1]

        secondWindow = UIWindow(frame: secondScreen.bounds)

        let viewController = UIViewController()
        secondWindow!.rootViewController = viewController

        secondWindow!.screen = secondScreen

        secondScreenView = UIView(frame: secondWindow!.frame)

        secondWindow!.addSubview(secondScreenView)

        secondWindow!.isHidden = false

        // CUSTOMISE VIEW
        secondScreenView.backgroundColor = UIColor.white

        // BATTING TEAM NAME - EXTERNAL
        battingTeamNameLabel.font = UIFont(name: "Arial-BoldMT", size: 80.0)
        battingTeamNameLabel.textColor = UIColor.blue
        battingTeamNameLabel.frame.origin = CGPoint(x:50, y:10)
0

There are 0 best solutions below