3 回答

TA貢獻(xiàn)1827條經(jīng)驗(yàn) 獲得超4個(gè)贊
iOS 7的最新情況
UIActionSheet is not designed to be subclassed, nor should you add views to its hierarchy
創(chuàng)建一個(gè)新的UITableViewController子類(lèi), SimpleTableViewController
.在情節(jié)提要中創(chuàng)建一個(gè)UITableViewController(嵌入在導(dǎo)航控制器中),并將其自定義類(lèi)設(shè)置為SimpleTableViewController。 給SimpleTableViewController的導(dǎo)航控制器一個(gè)“SimpleTableVC”的故事板ID。 在SimpleTableViewController.h中,創(chuàng)建一個(gè)NSArray屬性來(lái)表示表中的數(shù)據(jù)。 同樣在SimpleTableViewController.h中,創(chuàng)建一個(gè)協(xié)議 SimpleTableViewControllerDelegate
用所需的方法 itemSelectedatRow:
,以及名為類(lèi)型委托的弱屬性。 id<SimpleTableViewControllerDelegate>
..這就是我們將選擇傳遞回父控制器的方式。 在SimpleTableViewController.m中,實(shí)現(xiàn)tableview數(shù)據(jù)源和委托方法,調(diào)用 itemSelectedatRow:
在……里面 tableView:didSelectRowAtIndexPath:
.
itemSelectedAtRow:
UINavigationController *navigationController = (UINavigationController *)[self.storyboard instantiateViewControllerWithIdentifier: @"SimpleTableVC"];SimpleTableViewController *tableViewController = (SimpleTableViewController *)[[navigationController viewControllers] objectAtIndex:0];tableViewController.tableData = self.statesArray;tableViewController.navigationItem.title = @"States"; tableViewController.delegate = self;[self presentViewController:navigationController animated:YES completion:nil];
- 3 回答
- 0 關(guān)注
- 746 瀏覽
添加回答
舉報(bào)