-1
在我的故事板文件中,我有2個viewcontrollers。一個UITableViewController和一個ViewController。 我已經完成了他們所有需要的編碼。但我需要在ViewController的視圖中加載UITableView(及其數據)。 有什麼建議嗎?將UITableView加載到另一個ViewController中的視圖
在我的故事板文件中,我有2個viewcontrollers。一個UITableViewController和一個ViewController。 我已經完成了他們所有需要的編碼。但我需要在ViewController的視圖中加載UITableView(及其數據)。 有什麼建議嗎?將UITableView加載到另一個ViewController中的視圖
是的,你可以通過添加的UITableViewController作爲其ChildViewController這樣
UItableViewController*vc1 = [[test1 alloc]initWithNibName:@"SecondViewController" bundle:nil];
//add to the container vc which is self
[self addChildViewController:vc1];
//the entry view (will be removed from it superview later by the api)
[self.view addSubview:vc1.view];
如果你只需要一個UITableView顯示數據,並進一步則只需在任意視圖中添加的UITableView做這個簡單的做到這些。 而不是UITableViewController。 – 2015-01-22 09:55:56