2012-05-07 10 views
0

デリゲートに2つのUIViewControllerを示すコードがあります。 DataManger.hで表示コントローラをモーダルに表示する機能

RootViewController.m

request = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:@"***some https url here ***"]]; 
// custom implementation of NSURLConnectionDelegate 
dataman = [[DataManager alloc] initWithParentcontroller:self]; 
mainConn = [[NSURLConnection alloc] initWithRequest:request delegate:dataman]; 

AuthenticationViewController.hで

@protocol ShowAuthenticationWindowDelegate <NSObject> 
@required 
- (void) onFinishedEnteringCredentials:(NSURLCredential*)credentials; 
- (void) onCancelAuthentication; 
@end 

AuthenticationViewController.mで

- (IBAction) onClickLogin:(id)sender; 
{ 
    .... 
    // authDelegate => id <ShowAuthenticationWindowDelegate> 
    [authDelegate onFinishedEnteringCredentials:credentials]; 
    [self dismissModalViewControllerAnimated:YES]; 
    .... 
} 

(データマネージャークラス)NSURLConnectionDelegateShowAuthenticationWindowDelegateを実現します。

Datamanager.m didReceiveAuthenticationChallengeデリゲート機能では、ユーザ名/パスワードを収集するモーダルダイアログとしてAuthentiationViewControllerを表示します。ここで

-(void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge 
{ 
    AuthenticationViewController *authview = [[AuthenticationViewController alloc] initWithNibName:@"AuthenticationViewController" bundle:[NSBundle mainBundle]]; 
    authview.modalPresentationStyle = UIModalPresentationFullScreen; 
    authview.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; 
    authview.credentialsDelegate = self; 
    [rootController presentModalViewController:authview animated:YES]; 
} 

私は、ビュー内の活動の指標であるUIViewControllerを示しました。 dismissModalViewControllerという名前のログインボタンイベントハンドラの1つに以前のAuthenticationViewControllerダイアログを閉じると、モーダルに表示されます。チャレンジオブジェクト(以前にキャッシュされた)で資格情報を送信した後、私はActivityViewControllerをモーダルに示していますが、私は何をしても表示されません。私はUIAlertViewを表示しようとしましたが、私のactivityviewcontrollerは表示されません。私はすべてのパラメータとオブジェクトが有効であることを確認しました。デリゲートワイヤーアップ!すべてのコードが呼び出されていますが、ダイアログは表示されません。

私は何かが不足していますか?

- (void) onFinishedEnteringCredentials:(NSURLCredential*)credentials; 
{ 

    [[authChallenge sender] useCredential:credentials forAuthenticationChallenge:authChallenge]; 
    // create an activity modal dialog 
    if (activityController == nil) { 
     activityController = [[ActivityViewController alloc] initWithNibName:@"ActivityViewController" bundle:[NSBundle mainBundle]]; 
     activityController.modalPresentationStyle = UIModalPresentationFullScreen; 
     activityController.modalTransitionStyle = UIModalTransitionStyleCoverVertical; 
    } 
    [rootController presentModalViewController:activityController animated:YES]; 
} 

答えて

0

私は、誰もがバックアップするために、2つのモーダルダイアログをバック表示したい場合は、あなたが「NO」却下されているコントローラ上に「アニメーション」パラメータを設定する必要があり、解決策を見つけ出すを持っています。次のコントローラが "presentViewController"関数で表示されるまでにアニメーションの遷移が完了していないようです。

関連する問題