我有一個小應用程序,它使用多個部分佈局的初始表視圖。一部分顯示來自Twitter的最新趨勢,另一部分顯示來自Twitter的最新消息。當我點擊趨勢列表中的一個項目時,我轉換到一個新的表格視圖控制器,該控制器顯示關於該趨勢的最新推文。在故事部分的根控制器中,我可以在包含圖像,鏈接等的不同視圖控制器中顯示更多信息。問題是,當我選擇story部分中的任何內容時,我被推送到爲趨勢部分設置的表視圖控制器。我有一個名爲每個賽格瑞和定製類兩者,我想過渡的意見,我這樣做是爲了檢查被稱爲其賽格瑞:從表視圖控制器的多個賽段
-(void) prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
if([[segue identifier] isEqualToString:@"viewTrendsSearch"]) {
//get the controller that we are going to segue to
SearchTrendResultsViewController *strvc = [segue destinationViewController];
//get the path of the row that we want from the table view
NSIndexPath *path = [self.tableView indexPathForSelectedRow];
//here we get the trend object from the array we set up earlier to hold all trends
Trends *results = [currentTrends objectAtIndex:[path row]];
//pass the object that was selected in the table view to the destination view
[strvc setQuery: results];
}
if([[segue identifier] isEqualToString:@"storyfullDetails"]) {
StoriesViewController *svc = [segue destinationViewController];
NSIndexPath *path = [self.tableView indexPathForSelectedRow];
Stories *results = [currentStories objectAtIndex:[path row]];
[svc setStory:results];
}
}
如何讓不同意見的任何建議?
好的,謝謝!我會進一步研究這兩個選項,看看我能否繼續前進。關於解決方案1,您將如何實現多個原型表格單元格?在故事板界面中,你是否簡單地將另一個表視圖控制器拖到根控制器上? – swallace 2012-04-17 20:14:00
在IB中選擇表格視圖,屬性檢查器將控制原型單元的數量。或者將庫中的UITableViewCell拖入表中。無論哪種方式,一定要選擇每個單元格,並給它一個唯一的標識符。 – rickster 2012-04-17 21:38:01
優秀的解釋。幫助我更好地理解正在發生的事情 – Andrew 2012-07-25 02:15:33