私はXCodeに比較的慣れておらず、写真のコラージュアプリに取り組んでいます。コラージュを作成するためにテンプルを選択した後、ボタンをクリックして画像を選択したときにテンプルベースのコラージュを選択した後、フォトギャラリーから画像を選択し、そのボタンをクリックした後再び写真ライブラリを開きますが、一度だけ写真を選択した後、ボタンのアクションを無効にしたいので、問題を解決するのを手伝ってください
`
- (IBAction)choosepic:(id)sender {
UIAlertView *alert1=[[UIAlertView alloc]initWithTitle:@"Select Image from..." message:@"" delegate:self cancelButtonTitle:@"Image Gallary" otherButtonTitles:@"cancel", nil];
alert1.alertViewStyle=UIAlertViewStyleDefault;
alert1.tag=1;
[alert1 show];
[alert1 release];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
if (alertView.tag==1)
{
if(buttonIndex == 0)
imagepicker=[[UIImagePickerController alloc]init];
imagepicker.delegate=self;
imagepicker.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:imagepicker animated:YES];
}
}
-(IBAction)imagepickMethod1:(id)sender
{
imagepicker=[[UIImagePickerController alloc]init];
imagepicker.delegate=self;
imagepicker.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:imagepicker animated:YES];
button1.tag=100;
}
-(IBAction)imagepickMethod2:(id)sender
{
imagepicker=[[UIImagePickerController alloc]init];
imagepicker.delegate=self;
imagepicker.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:imagepicker animated:YES];
button1.tag=101;
}
-(IBAction)imagepickMethod3:(id)sender
{
imagepicker=[[UIImagePickerController alloc]init];
imagepicker.delegate=self;
imagepicker.sourceType=UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:imagepicker animated:YES];
button1.tag=102;
}
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo
{
[picker dismissModalViewControllerAnimated:YES];
if (button1.tag==100)
{
photoPreviewImageView1.image=image;
}
else
if (button1.tag==101)
{
photoPreviewImageView2.image=image;
}
else
{
photoPreviewImageView3.image=image;
}
}
`