1

こんにちは、私はこの IBAction をボタンにリンクしています:

- (IBAction)showCurl:(id)sender {
        alert1 = [[UIAlertView alloc]initWithTitle:@"Loading" message:nil delegate:self cancelButtonTitle:nil otherButtonTitles:nil];
        [alert1 show]; 

}

自動実行する clickedButtonIndex が、どういうわけか SecondViewController をロードしません。

#pragma mark UIAlertView
- (void)alertView:(UIAlertView *)alert1 clickedButtonAtIndex:(NSInteger)buttonIndex {
    if(buttonIndex == 0){
        SecondViewController *sampleView = [[SecondController alloc] init];
        [sampleView setModalTransitionStyle:UIModalTransitionStylePartialCurl];
        [self presentModalViewController:sampleView animated:YES];
        }
    else{
            // Cancel prompt
        }
}

ここで何か不足していますか?

4

2 に答える 2

2

アラート ビューにいくつかのボタン タイトルを付けないと、タップするボタンがなくなり、デリゲート メソッドが呼び出されません。

- (IBAction)showCurl:(id)sender {
        alert1 = [[UIAlertView alloc] initWithTitle:@"Loading" message:nil delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [alert1 show]; 
}
于 2012-05-03T16:45:53.303 に答える
0

あなたのコードはボタンを表示しません

 alert1 = [[UIAlertView alloc]initWithTitle:@"Loading" message:nil delegate:self cancelButtonTitle:**nil** otherButtonTitles:**nil**];

cancelButtonTitle として nil を渡し、otherbuttonTitles として nil を渡します。少なくとも 1 つのボタン タイトルを設定する必要があります。

于 2012-05-03T17:03:36.023 に答える