2011-12-10 13 views
0

私のUIAlertViewでは、「OK」ボタンが押されたときに別のUIViewを開きたいとします。応答アクションが実行された後でもUIAlertViewがフェーディングしない

しかし、問題があるが、UIViewのが表示された後も、アラートが画面に残り、それが消えたら、UIViewのは無効になっているようです。

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Add details" message:@" Do you like to set the details now?" delegate:self cancelButtonTitle:@"Yes" otherButtonTitles:@"No",nil]; 
[alert show]; 
[alert release]; 

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex 
{ // the user clicked one of the OK/Cancel buttons 
    NSString *title = [alertView title]; 

    if([title isEqualToString:@"Add details"]) 
    { 
     ....... 

助けてください。

答えて

0

タイトルの代わりにデリゲートメソッドで押されたボタンをチェックしないのはなぜですか?

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex 
{ 
    if (buttonIndex == 0){ 
     // User pressed "YES" 
    }else{ 
     // User pressed "NO" 
    } 
} 

である 、キャンセルボタンは、インデックス0を持ち、他のボタンがインデックスに増加。このアラートを検出するには、タグを付ける必要があります。お役に立てれば。アラートビューが実際に却下される前に、新しいビューが追加されているので

0

が可能でした。だから、より良いの

- (void) alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex 
{ 
//Add the view 
} 

代わりclickedButtonAtIndexするのではなく、既存のアラートビューのボタンクリックイベントに新しいビューを表示するためにdidDismissWithButtonIndexデリゲートを使用

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex 
{ 
//Add the view 
} 
関連する問題