首先,我想你可以通過計算你的字典對象顯示的行數。我從字典中使用NSMutableArray轉換,因爲它更容易操作。但它完全是個人的。
另外我有一個的DetailView,我需要單獨顯示每個該字符串。
你能做什麼?
有一個函數叫做didSelectRowAtIndexPath委託方法。
如果選擇行此功能called.In此功能你抓你的DetailView控制器,並根據您的數據保存價值的它是一個變量(的NSString或東西)。 您可以在分配值後從這裏以編程方式調用segue。
舉個例子:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView deselectRowAtIndexPath:indexPath animated:NO];
DetailViewController *detailVC = [[DetailView alloc] initWithNibName:@"DetailView" bundle:nil];
detailVC.userName = [userList objectAtIndex:indexPath.row];
[self.navigationController pushViewController:detailVC animated:YES];
}
或者,如果你不想使用這個樣子,然後在prepareForSegue方法(你叫什麼) 抓住你的目標視圖控制器,並分配值一樣以前。而已。
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{
// Make sure your segue name in storyboard is the same as this line
if ([[segue identifier] isEqualToString:@"YOUR_SEGUE_NAME_HERE"])
{
// Get reference to the destination view controller
YourViewController *vc = [segue destinationViewController];
vc.dictionary = [youdictionary mutableCopy];
// Pass any objects to the view controller here, like...
[vc setMyObjectHere:object];
}
}
右鍵字典中的主陣列的元素個數一個NSArray是位於另一個自定義類,所以我想這樣得到這個:NSArray * library = [self.eVielasLibrary.library valueForKey:kEviela];返回[library count];但它表明圖書館是零。 –
你沒有提到*其他自定義類*。編輯你的問題,並添加所有相關信息如何與類相關。 – vadian