0

ユーザーが最初のセルの1つをクリックすると、2番目のテーブルビューが表示されます。しかし、最初のView Controllerを2番目のView Controllerで選択した値で更新する方法がわかりません。リンクや例を教えてください。

ありがとう

4

1 に答える 1

1

このようにtableViewを区別できます...ここでは、tblMain1とtableDetailの2つのtableViewを使用します

 - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    // Return the number of rows in the section.
    if (tableView==tblMain) 
    {
        return [arrOfProfileView count];
    }
    else
    {
        return [arrOfProfileView2 count];
    }
 }

 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:nil];
    if (cell == nil) 
    {
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:nil] autorelease];
    }
    if (tableView==tblMain) 
       {
           //write code here for your mainTable.
       }
       else
       {
           //write code here for your detailTable.
       }

      return cell
 }

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (tableView==tblMain1) 
    {
        //write code here
        [tableDetail reloadData];
    }
    else{
         //write code here
         [tblMain1 reloadData];
    }
}
于 2012-06-14T10:42:00.197 に答える