我構建了一個應用程序故事板我需要356 viewcontroller故事板,這是很多,它是不可能與這麼多屏幕一起工作我在故事板創建標籤欄和表格單元格我創建xib我想做的關於從xib到故事板上的表格單元格怎麼辦?如何將xib與故事板相關聯
謝謝!
我構建了一個應用程序故事板我需要356 viewcontroller故事板,這是很多,它是不可能與這麼多屏幕一起工作我在故事板創建標籤欄和表格單元格我創建xib我想做的關於從xib到故事板上的表格單元格怎麼辦?如何將xib與故事板相關聯
謝謝!
你有太多的視圖控制器,但是心情不好的實際問題:
UIStoryBoard *storyBoard = [UIStoryboard storyboardWithName:storyboardName bundle:nil];
BrowserViewController *vc = (BrowserViewController*)[storyboard instantiateViewControllerWithIdentifier:@"BrowserViewController"];
//get whatever instance you want off the VCs properties a table view or whatever
// but usually youll just want to push it onto a nav controller
[[self navigationController] pushViewController:vc animated:YES];
你可以從TableViewController線到其他視圖。
例如,首先,可以如下所示進行設置TableViewCell:
當抽頭的單元格,帶螺紋細胞數目的圖。
要發送竊聽細胞的數量,未來的ViewController,可以使用performSegueWithIdentifier:sender:
和prepareForSegue:sender
如下。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[self performSegueWithIdentifier:@"showDetail"
sender:[NSString stringWithFormat:@"%d", indexPath.row + 1]];
}
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
DetailViewController *c = segue.destinationViewController;
c.string = (NSString *)sender;
}
您可以下載該項目並運行它。
感謝男人我嘗試它 – user1569766 2012-08-09 09:44:29
這是我的項目http://www.sendspace.com/file/9186fm現在我需要365視圖控制器(語言是希伯來語) – user1569766 2012-08-09 10:26:42
這是一本書嗎?我想你想製作365頁的電子書,每一頁都有自己的內容。我建議你不要製作365 ViewControllers而是365圖片。您可以將圖像更改爲單擊的單元格。這個怎麼樣 ? – weed 2012-08-09 10:40:41
哇 - 跑跑的句子很多。學習使用句點('。's)。我會編輯,但我真的不知道你想說什麼。請修正你的語法。 – anthropomorphic 2012-08-08 23:34:25
如果你真的需要數百個視圖控制器,我會非常非常驚訝。你能給出一些關於你在做什麼的背景嗎? – Jim 2012-08-08 23:34:59
這是我的項目sendspace.com/file/9186fm併爲我的英語感到抱歉(該項目的語言是希伯來語) – user1569766 2012-08-09 10:34:12