2

ストーリーボードを使用しています。テーブルビューで要素が選択されたときにサブビューを追加したい。

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [arr count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    if (cell == nil)
    {
    cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
    }

    NSString *cellvalue = [arr objectAtIndex:indexPath.row];

    cell.textLabel.text=cellvalue;

    cell.imageView.image=[UIImage imageNamed:@"1.png"];

    return cell;
}
4

2 に答える 2

1

ストーリーボードは、アプリ フローを示すのに役立ちます。したがって、ストーリー ボードにフローを表示せずにビューを追加しても意味がありません。

ストーリーボード セグエ (オン ビューから別のビューへの接続) には、プッシュ、モーダル、カスタムの 3 種類があります。モーダルとしてプッシュまたは表示したくない場合は、の perform メソッドをオーバーライドして、独自のカスタム セグエを作成できますUIStoryboardSegue

 - (void)perform
{
// Add your own code here.

    [[self sourceViewController] addChildViewController:[self destinationViewController]];
}

カスタム セグエの開発者リファレンス

于 2013-08-06T08:50:40.400 に答える
0

StoryBoard から直接作成したい場合は、テーブル ビュー セル (プロトタイプ セル) から目的のビューに Ctrl キーを押しながらドラッグする必要があります。

于 2013-08-06T08:46:05.937 に答える