私は xcode と Objective-C プログラミングが初めてで、助けが必要です。
1 つのビューでデータの配列と 2 つの UITableViews を使用する ios 用の基本的なプログラムを作成しようとしています。最初のテーブルで行われた選択に基づく配列によって、2 番目の UITableView を設定したいと考えています。2 番目のテーブルの配列の配列があります。しかし、最初のテーブルでインデックス 0 のデータが選択されている場合、インデックス 0 に配列を配置する方法を理解できません。
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [technologyData count];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
// Change UITableViewCellStyle
cell = [[[UITableViewCell alloc]
initWithStyle:UITableViewCellStyleSubtitle
reuseIdentifier:CellIdentifier] autorelease];
}
if (tableView == technologyTable)
{
[[cell textLabel] setText:[technologyData objectAtIndex:indexPath.row]];
}
if (tableView == experienceTable)
{
cell.textLabel.text = [[experience objectAtIndex:indexPath.row]objectAtIndex:indexPath.row];
[experienceTable reloadData];
}
return cell ;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
if (tableView == technologyTable)
{
experienceTable = [[experience objectAtIndex:indexPath.row] objectAtIndex:indexPath.row];
selectTechnology.text = [technologyData objectAtIndex:indexPath.row];
self.technologyList.hidden = YES;
}
if(tableView == experienceTable)
{
self.experienceList.hidden = YES;
selectExperience.text = [[experience objectAtIndex:indexPath.row] objectAtIndex:indexPath.row];
}
}