swift 學習之路

1、swift 實現頁面切換的方法:

self.window = UIWindow(frame: UIScreen.mainScreen().bounds)

self.window!.backgroundColor = UIColor.whiteColor()

self.window!.rootViewController = RKRootViewController(nibName:"RKRootViewController",bundle:nil)

self.window!.makeKeyAndVisible()


2、swift 關聯與之對映名稱的xib視圖方法

convenience override init() {

        var nibNameOrNil = String?("RKRootViewController")

        //考慮到xib文件可能不存在或被刪,故加入判斷

        if NSBundle.mainBundle().pathForResource(nibNameOrNil, ofType: "xib") == nil{

            nibNameOrNil = nil

        }

        self.init(nibName: nibNameOrNil, bundle: nil)

}


3、swift 打印變量的方法

println("\(Hello)")


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章