Created
November 1, 2014 14:03
-
-
Save regnerjr/b665c856c381cb52c85b to your computer and use it in GitHub Desktop.
Stack overflow answer for http://stackoverflow.com/questions/26689731/xcode-doesnt-load-a-custom-view
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
| // | |
| // ViewController.swift | |
| // error-view | |
| // | |
| // Created by John Regner on 11/1/14. | |
| // Copyright (c) 2014 In Your Dreams Software. All rights reserved. | |
| // | |
| import UIKit | |
| class ViewController: UIViewController { | |
| override func viewDidLoad() { | |
| super.viewDidLoad() | |
| ErrorView.errorInView(self.view, animted: true) | |
| } | |
| } | |
| class ErrorView: UIView { | |
| class func errorInView(view:UIView, animted:Bool) -> ErrorView { | |
| println("ERROR VIEW LOADED") | |
| //let errorView = ErrorView(frame: view.bounds) | |
| //var errorView = ErrorView(frame: view.bounds) | |
| let errorView = NSBundle.mainBundle().loadNibNamed("ErrorView", owner: self, options: nil)[0] as ErrorView | |
| //errorView.backgroundColor = UIColor.purpleColor() | |
| errorView.opaque = false | |
| view.addSubview(errorView) | |
| return errorView | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment