Skip to content

Instantly share code, notes, and snippets.

@rexchen
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rexchen/f300f0b428546ef264f7 to your computer and use it in GitHub Desktop.
Save rexchen/f300f0b428546ef264f7 to your computer and use it in GitHub Desktop.
import UIKit
@UIApplicationMain
class AppDelegate : UIResponder, UIApplicationDelegate {
var window : UIWindow?
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
self.window = UIWindow(frame:UIScreen.mainScreen().bounds)
self.window!.rootViewController = UIViewController()
let mainView = self.window!.rootViewController!.view
let newView = UIView(frame: CGRectMake(100, 100, 50, 50))
newView.backgroundColor = UIColor.redColor()
mainView.addSubview(newView)
self.window!.backgroundColor = UIColor.whiteColor()
self.window!.makeKeyAndVisible()
return true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment