2015年12月22日 星期二

用xib換掉storyboard

一、先到info.plist中把Main storyboard file base name這個tag拿掉

二、再到appDelegate的didFinishLaunchingWithOptions中加入rootViewController
例如
let navigationVC: UINavigationController = UINavigationController(rootViewController: yourViewController)
        
let frame = UIScreen.mainScreen().bounds
window = UIWindow(frame: frame)
        
window!.rootViewController = navigationVC
window!.makeKeyAndVisible()

2015年12月2日 星期三

是否需要在用來建TableView Cell的xib中指定file's owner?

不用,
xib是一個圖形與程式的連接控制介面,xib裡面放的UI物件,
file's owner是外部的控制器,所以你的cell不能在xib裡面跟外面同時存在。

意思是,你在xib裡面直接拉UI (cell也是一種UI)
外面用view controller指給file's owner來存取使用。

將狀態列文字改為白色(iOS 7.0以上適用)

先到info.plist中新增一行View controller-based status bar appearance 並設為 no

UIApplication.sharedApplication().statusBarStyle = UIStatusBarStyle.LightContent