swift ändern uiviewcontroller Sicht

Erstelle ich eine neue UIViewController ich nicht verwenden, storyboard, das ist mein code. Ich möchte ändern meine Ansicht Rahmen, dieser nicht Arbeit für mich, ich musste versuchen, add-on - viewWillAppear es immer noch nicht funktionieren, ich weiß, ich kann hinzufügen eines neuen UIView es zu tun. Kann ich mein viewcontroller Sicht? Vielen Dank für Ihre Hilfe.

import UIKit

class NewDetailViewController: UIViewController {

    override func viewWillAppear(animated: Bool) {
        super.viewWillAppear(animated)

    }
    override func viewDidLoad() {
        super.viewDidLoad()

        let statusBarHeight: CGFloat = UIApplication.sharedApplication().statusBarFrame.height
        let navBarHeight             = self.navigationController?.navigationBar.frame.size.height

        println("statusBarHeight: \(statusBarHeight) navBarHeight: \(navBarHeight)")

        //view
        var x:CGFloat      = self.view.bounds.origin.x
        var y:CGFloat      = self.view.bounds.origin.y + statusBarHeight + CGFloat(navBarHeight!)
        var width:CGFloat  = self.view.bounds.width
        var height:CGFloat = self.view.bounds.height - statusBarHeight - CGFloat(navBarHeight!)
        var frame:CGRect   = CGRect(x: x, y: y, width: width, height: 100)

        println("x: \(x) y: \(y) width: \(width) height: \(height)")

        self.view.frame           = frame
        self.view.backgroundColor = UIColor.redColor()
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
    }
}
InformationsquelleAutor lighter | 2015-06-06
Schreibe einen Kommentar