0

クラス:

  • AppDelegate
  • AppViewController
  • その他のViewController

現在、アプリケーションは AppViewController で開きます。新しいビュー、OtherViewController を追加したいと考えています。ただし、AppViewController のメソッドを、OtherViewController が情報を表示するために使用できる MutableArray に保存する必要があります。

1- AppDelegate のどこに MutableArray を作成すればよいですか? そして、どうすればそれにアクセスできますか?

AppViewController でオブジェクトをスワイプして、OtherViewController をスライドさせる機能が欲しいのですが、OtherViewController の戻るボタンを使用して戻るだけです。

2- どうすればコントローラーを切り替えることができますか?

助けてくれてありがとう!

4

1 に答える 1

0

NSMutableArray を otherViewController (たとえば、otherArray) に作成します...その配列のプロパティを設定することを忘れないでください..そのオブジェクトのゲッターおよびセッターとして使用されるため..この場合、その配列オブジェクトの値を設定する必要があります..

AppViewController から移動すると、viewcontroller が次のように表示されます。

        OtherViewController *obj=[[OtherViewController alloc] initWithNibName:@"OtherViewController" bundle:nil];
            //Here
        obj.otherArray = yourArrayInAppViewController;
        [self presentModalViewController:obj animated:YES];
        [obj release];

OtherViewController の ViewDidLoad の NSLog otherArray カウントだけです。配列が渡されたことがわかります...

于 2011-02-01T17:50:06.543 に答える