2012-01-15 10 views
0

私はこの同じコードを私のアプリケーションの2つの異なる部分に持っています。 あるセクションでは完全に実行され、他のセクションでは完全に無視されます。私はブレークポイントを入れて、プログラムが次のxib /クラスをロードせずにこのコードの各行を調べるのを見ました。ここでモーダルビューコントローラを提示

コードです:これは無視され、私のViewControllerを提示していない取得される可能性がありますなぜ

UIViewController *nextController = [[ClassNameViewController alloc] initWithNibName:@"MatchingView" bundle:nil]; 

[nextController performSelector:@selector(setDelegate:) withObject:self]; 

[self presentModalViewController:nextController animated:YES]; 

任意のアイデア?

+0

'performSelector:withObject:'のポイントは何ですか?なぜ 'nextController.delegate = self'ですか? – Costique

+0

なぜ[nextViewController setDelegate:self] 'の代わりに' [nextController performSelector:@selector(setDelegate :) withObject:self]; 'を呼びますか? – V1ru8

+0

nextController.delegate = self; "UIViewController * '型および[nextController setDelegate:self]のオブジェクトにプロパティ'代理人 'が見つかりません。 "UIViewControllerはセレクタ 'setDelegate'でメソッドを宣言していません" – RanLearns

答えて

0

..使用してみてください私は、のviewDidLoadでこのコードを持っていたし、viewDidAppearに移動すると、それが働かせました。

0

[self.navigationController presentModalViewController:nextController animated:YES]; 
+0

あなたの返信のおかげで - それも動作しませんでした= – RanLearns

関連する問題