What is the largest possible size of a UIView in a Swift Playground?

女生的网名这么多〃 提交于 2019-12-13 03:36:36

问题


I'm trying to create a UIView in Swift Playground (in Xcode). My goal is to create the largest possible view. The current size is 1024 x 768. And if I try to increase the width or height, the view (when played in Live View) actually gets smaller which I think is happening so that it scales down to the window. But when I look at the Live View on 15-inch Macbook, there's a lot of space in the Live View -- the width can be increased, but I don't know how to increase it such that it actually takes up the entire screen.

Is there anyway to set the width to "full-screen"?

My code:

public class thisIsRandom: UIView {

    override public init(frame: CGRect) {
        super.init(frame: CGRect(x: 0, y: 0, width: 1024, height: 768))

        self.backgroundColor = .black
    }

}

回答1:


PlaygroundLiveViewRepresentation support size as per your screen display. I have MacBook Air 13 inch.

I have running live view in playground with 2048x1024 size, this show me large. This means it will show exactly on your screen size.

If same code will run in MacBook pro then it will smaller view, But, Also if your run this same code in iMac then it will display very small size of live view.

So, live view display on your MacBook, iMac screens size. I hope this will helpful to you.



来源:https://stackoverflow.com/questions/49433756/what-is-the-largest-possible-size-of-a-uiview-in-a-swift-playground

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!