关键代码
func application(application: UIApplication!, didFinishLaunchingWithOptions launchOptions: NSDictionary!) -> Bool {
let rvc:ViewController=ViewController()
let nav=UINavigationController(rootViewController: rvc)
self.window!.rootViewController=nav
return true
}
===============================
class ViewController: UIViewController {
var mylable=UILabel()
// @IBOutlet strong var uiview: UIView
override func viewDidLoad() {
super.viewDidLoad()
self.title="nimei"
self.view.backgroundColor=UIColor.whiteColor()
var but=UIButton(frame:CGRect(x: 11, y: 12, width: 23, height: 34))
but.backgroundColor=UIColor.whiteColor()
self.view.addSubview(but)
var la=UILabel(frame:CGRect(x: 100, y: 100, width: 220, height: 50))
la.text="nishiahsbima"
self.view.addSubview(la)
let nextItm=UIBarButtonItem(title: "xiayie", style:.Plain, target: self, action: "niemi");
self.navigationItem.rightBarButtonItem=nextItm
}
func niemi(){
let sev:secondview=secondview()
self.navigationController.pushViewController(sev,animated: true)}
===========================================
import Foundation
import UIKit
class secondview:UIViewController{
override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor=UIColor.whiteColor()
}
}