Кнопка отмены UIActionSheet продолжает сбой моего приложения - PullRequest
2 голосов
/ 12 мая 2010

Я действительно озадачен этим. Я установил два UIActionSheets в моем приложении. Они прекрасно работают, пока вы не используете кнопку отмены в UIActionSheets.

Когда я ухожу со страницы, UIAactionSheet также возвращает мое приложение. 1003 *

У кого-нибудь есть идеи, почему тоже?

-(IBAction) phoneButtonClicked:(id)sender
{
// open a dialog with just an OK button
phoneActionSheet = [[UIActionSheet alloc] initWithTitle:nil
                                                    delegate:self cancelButtonTitle:@"Cancel" 
                                                    destructiveButtonTitle:nil 
                                                    otherButtonTitles:[NSString stringWithFormat:@"Phone: %@",phone],nil];
phoneActionSheet.actionSheetStyle = UIActionSheetStyleDefault;
[phoneActionSheet showInView:self.view];    // show from our table view (pops up in the middle of the table)
[phoneActionSheet release]; 
}

-(void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {

if (actionSheet == phoneActionSheet) {

    if(buttonIndex == 0){
            NSString *callPhone = [NSString stringWithFormat:@"tel:%@",phone];
            NSLog(@"Calling: %@", callPhone);
            [[UIApplication sharedApplication] openURL:[NSURL URLWithString:callPhone]];
    }
}

}

1 Ответ

1 голос
/ 12 мая 2010

Я бы предложил не публиковать лист действия телефона в кнопке phoneClicked. Я подозреваю, что вы пытаетесь что-то сделать с плохим указателем. Другая полезная помощь - использовать NSZombieEnabled .

...