1
|
self .presentViewController( MainTabViewController (), animated: true , completion: nil ) |
1
2
3
4
5
6
7
8
9
10
11
12
|
let tabController = MainTabViewController () tabController.param = "这个是传递的参数" self .presentViewController(tabController, animated: true , completion: nil ) class MainTabViewController : UITabBarController { var param: String ? override func viewDidLoad() { } } |
1
2
3
4
5
6
7
8
|
class MainTabViewController : UITabBarController { var param: String ? init (param: String ) { self .param = param } } |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
class MainTabViewController : UITabBarController { var param: String ? init (param: String ) { self .param = param super . init (nibName: nil , bundle: nil ) } required init ?(coder aDecoder: NSCoder ) { fatalError( "init(coder:) has not been implemented" ) } override func viewDidLoad() { } } self .presentViewController( MainTabViewController (param: "这个是传递的参数" ), animated: true , completion: nil ) |
Swift - 重写UIKit框架类的init初始化方法(以UITabBarController为例)
原文:http://www.cnblogs.com/machao/p/5133381.html