-
-
Save senthilvs7/23b6ab61ac927972ca90 to your computer and use it in GitHub Desktop.
iPhone View Simulation on Playground
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import XCPlayground | |
| import UIKit | |
| import QuartzCore | |
| let zoom:CGFloat = 0.5 | |
| let deviceSize = CGSize(width: 640*zoom, height: 1136*zoom) | |
| let statusBarHeight:CGFloat = 48*zoom | |
| let navBarHeight:CGFloat = 88*zoom | |
| let tabBarHeight:CGFloat = 98*zoom | |
| let bgColor = UIColor(white: 0, alpha: 0.01) | |
| let showStatusBar = true | |
| let font = UIFont(name: "HelveticaNeue-Light", size: 62) | |
| let view = UIView(frame: CGRect(x: 0, y: 0, width: deviceSize.width, height: deviceSize.height)) | |
| XCPShowView("iphone", view) | |
| view.backgroundColor = bgColor | |
| var frame = view.frame | |
| frame.size.height = statusBarHeight | |
| let sview = UIView(frame: frame) | |
| if showStatusBar{ | |
| sview.backgroundColor = UIColor(white: 0, alpha: 0.4) | |
| view.addSubview(sview) | |
| } | |
| let label = UILabel(frame: CGRect.zeroRect) | |
| label.frame.origin.y = 100 | |
| label.text = "Hello\nPlayground" | |
| label.numberOfLines = 2 | |
| label.font = font | |
| label.sizeToFit() | |
| view.addSubview(label) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment