我曾嘗試使用數組來推到一個UIViewController:如何使用NSDictionary從UITableViewController推送到UIViewController?
[email protected][@"New York", @"Chicago", @"Los Angeles", @"Miami"];
,然後在我的didSelectRowAtIndexPath
:
[self.navigationController pushViewController:NewYorkViewController animated:YES];
但現在所有的在陣推項目NewYorkViewController
。我相信一個NSDictionary
會工作
NSDictionary *[email protected][@{@"city":@"NewYork",@"viewController":NewYorkViewController}, @{@"city":@"Chicago",@"viewController":ChicagoViewController}, @{@"city":@"LosAngeles",@"viewController":LosAngelesViewController}, @{@"city":@"Miami",@"viewController":MiamiViewController}];
但是我是小白,從來沒有與NSDictionary
工作。如果你會如此善意地解釋我將如何去做這件事。如果你知道使用數組的方法,那也可以。
ps。 我不使用storyboards
,可能還解釋什麼,我會在我的cellForRowAtIndexPath
做的事:和numberOfRowsInSection
:
感謝
在NSDictionary .. {「viewController」:[NewYorkViewController class}} .. then [self.navigationController pushViewController:[[NSDictionary objectFor:「New York」] alloc] init] animated:YES]; – zt9788
你介意在迴應中擴展嗎? – rivtracks