1、swift程序入口对象和协议
class AppDelegate: UIResponder, UIApplicationDelegate
2、swift程序入口函数
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {}
3、新增ViewController
4、ViewController中加载函数
override func viewDidLoad() {}
4.1Navigation:
let nextItm = UIBarButtonItem(title: "Next Page", style:.Plain, target:self , action: "nextPage")
self.navigationItem.rightBarButtonItem = nextItm
self.navigationController?.pushViewController(sec, animated: true) //下一页
self.navigationController?.popViewControllerAnimated(true) //上一页
4.2添加视图
self.view.addSubview(myLabel!)
5、AppDelegate添加view和Navigation
let rvc = RootViewController()
let nav = UINavigationController(rootViewController: rvc)
self.window!.rootViewController = nav
6、注册事件
b.addTarget(self, action: "ClickMe:", forControlEvents: .TouchUpInside)
7、代理,反向传值
第二页面:定义代理、定义函数、声明代理、调用方法
第一页面:签署协议、注册、实现方法