私はギャラリーからまたはカメラから写真を撮る方法を選択できるようにする機能があります。 「コンテンツ」がない場合(既に写真を撮っていない場合)、自由に行うことができます。コンテンツを持っている場合(既に写真を撮っている場合)、ダイアログボックスが表示され、あなたが確信しているかどうかを尋ねます。 UIAlertViewDelegateを実装して、どのボタンが押されたかを知ることができます。UIAlertViewコール機能がありません
私の問題はOK(ボタンインデックス0)を押しても機能しない(呼び出されて、デバッガで処理される)という問題が発生します。もう一度ボタンを押すと別のダイアログボックスが表示されません。
私は問題が何であるか分かりません。私はGoogleに何を試してみるか考えません。
ご協力いただきありがとうございます。
-(IBAction)galleryButtonPressed:(id)sender
{
if (!mHasContent)
{
[mDelegate performSelector:@selector(galleryButtonPressed:) withObject:self];
}
else
{
UIAlertView* warning = [[UIAlertView alloc] initWithTitle:@"Section Complete" message:@"You have already taken an image. Selecting another will overwrite it, you can select to take another image above. Are you sure you wish to continue?" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: @"Cancel", nil];
[warning setTag:GALLERY];
[warning show];
[warning release];
}
}
-(IBAction)cameraButtonPressed:(id)sender
{
if (!mHasContent)
{
[mDelegate performSelector:@selector(captureImageButtonPressed:) withObject:self];
}
else
{
UIAlertView* warning = [[UIAlertView alloc] initWithTitle:@"Section Complete" message:@"You have already taken an image. Selecting another will overwrite it, you can select to take another image above. Are you sure you wish to continue?" delegate:self cancelButtonTitle:nil otherButtonTitles: @"OK", @"Cancel", nil];
[warning setTag:CAMERA];
[warning show];
[warning release];
}
}
-(void)alertView:(UIAlertView *)alertView didDismissWithButtonIndex:(NSInteger)buttonIndex
{
// If they selected OK then resend the event to take a photo or select from the gallery
if (buttonIndex == 0)
{
mHasContent = NO;
if ([alertView tag] == GALLERY)
{
[self galleryButtonPressed:mGalleryButton];
}
else
{
[self cameraButtonPressed:mCameraButton];
}
}
}
私はまたのonClickとwillDismiss ....でこれを試してみましたが、それらのどれもどちらか働きました。
申し訳ありませんが、私は言っていたはずです。私はすでにそれを試してきましたし、 "willDissWithButtonIndex"でもあり、どちらもうまくいきませんでした。 – Luke