0

私は[self presentModalViewController:head animated:NO];iOS4.3で使用しており、iOS5以降の代替品を探しています。私はすべてのiOSバージョンに普遍的なものを使用したいのですが、それif (iOS is lower than 6)も素晴らしいことです。私の問題は、がに設定されている場合にのみ[self presentViewController:head animated:YES completion:nil];、代替として使用することが機能することです。なぜですか?アニメートしたくない。使用していない場合に使用できるものは他にありますか?animatedYESStoryBoards

4

1 に答える 1

1

アプリはまったく失敗しますか?NSZombiesを有効にしましたか?

あなたがこのようなことをしているなら

- (id)init {
    self = [super init]

    if (self) {
       ViewController * viewController = [[ViewController alloc] init];
       [self presentViewController:viewController animated:YES];
    }

    return self;
}

これは、ビューがまだ開始されていないためです。次のいずれかの方法を使用してください

- (void)viewDidAppear:(BOOL)animated {
   [super viewDidAppear:animated];

   ViewController * viewController = [[ViewController alloc] init];
   [self presentViewController:viewController animated:YES];

}

// OR

- (void)viewDidLoad {
   [super viewDidLoad];

   ViewController * viewController = [[ViewController alloc] init];
   [self presentViewController:viewController animated:YES];

}

これはあなたの質問に答えないかもしれないと理解していますが、あなたはそれがどのイニシエーターであるかを投稿しませんでした。しかしこれは一般的なエラーなので、問題が解決する場合に備えて投稿すると思いました。

于 2013-02-04T16:13:38.147 に答える