0

こんにちは、私が取り組んでいるアプリを更新しようとしています。もともとアプリは 5 ビュー タブ ビュー アプリでした。アプリを変更してタブの数を減らすことにしたので、3 つのタブをテーブル リストに移動し、そこからロードして、タブ バーのスペースを他のもののために解放したいと考えています。実装に取り​​組みたい。

これを実現するために、テーブル ビューを設定し、詳細を .plist から tableView にロードすると考えました。.plist で .xib ファイルに名前を付けてから、これらの名前を取得し、それらを使用して適切な .xib ファイルをビューにプッシュできると考えました。理論的には(少なくとも私の頭の中では)すべて問題ないように思えますが、これを行うにはいくつか問題があります。テーブルビューを作成するという点で .plist を正常に機能させることができますが、ペン先の名前を渡し、それを使用して正しいビューをプッシュする方法がわからないため、行き詰まります。誰でも私にこれを説明できますか。私のplistは次のようになります:

<array>
<dict>
    <key>rowData</key>
    <array>
        <dict>
            <key>calcType</key>
            <string>Item 1</string>
            <key>subdetails</key>
            <string>some stuff about item 1</string>
            <key>nibName</key>
            <string>nibOne.xib</string>
        </dict>
        <dict>
            <key>calcType</key>
            <string>Item 2</string>
            <key>subdetails</key>
            <string>some stuff about item 2</string>
            <key>nibName</key>
            <string>nibTwo.xib</string>
        </dict>
        <dict>
            <key>calcType</key>
            <string>Item 3</string>
            <key>subdetails</key>
            <string>some stuff about item 3</string>
            <key>nibName</key>
            <string>nibThree.xib</string>
        </dict>
    </array>
</dict>

私の didSelectRowAtIndex メソッドは現在、次のようになっています。

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{


     //Get the dictionary of the selected data source.
NSDictionary *dictionary = [[[self.artCalculators     objectAtIndex:indexPath.section]objectForKey:@"rowData"] objectAtIndex:indexPath.row];

CalcDetailViewController *controller = [[CalcDetailViewController alloc] initWithNibName:@"CalcDetailViewController" bundle:[NSBundle mainBundle]]; 

 controller.title = [dictionary objectForKey:@"calcType"];

 [self.navigationController pushViewController:controller animated:YES];

変更が必要な行は次のとおりです。

CalcDetailViewController *controller = [[CalcDetailViewController alloc] initWithNibName:@"CalcDetailViewController" bundle:[NSBundle mainBundle]];

しかし、それが何である必要があるのか​​ よくわかりません。誰でも教えてもらえますか?

4

1 に答える 1