UILongPressGestureRecognizerが、handleLongPressOnPhotosというアクションでimageViewに追加されました。 - [UILongPressGestureRecognizer画像は]:UIImageWriteToSavedPhotosAlbumを使用して画像を保存すると、認識できないセレクタエラー
アクションシートの「写真を保存」ボタンをクリックする- (IBAction)handleLongPressOnPhotos:(UIImageView *)sender{
self.imageWillBeSaved = sender;
UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:nil delegate:self cancelButtonTitle:@"Cancel" destructiveButtonTitle:@"Save the photo" otherButtonTitles: @"Go to the Original photo", nil];
actionSheet.actionSheetStyle = UIActionSheetStyleDefault;
[actionSheet showInView:self.view];
[actionSheet release];
}
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex{
switch (buttonIndex) {
case 0:
UIImageWriteToSavedPhotosAlbum(self.imageWillBeSaved.image, self, @selector(image: didFinishSavingWithError:contextInfo:), nil);
break;
default:
break;
}
}
- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
{
if (error != NULL)
{
// handle error
}
else
{
// handle ok status
}
}
、エラーメッセージがとおり最も関連するコードは以下の通りである未認識セレクタインスタンスに送信0x21c2a0 コード内に問題はありますか?前もって感謝します!
ここであなたはUILongPressGestureRecognizerを追加しましたか?そのコードも追加してください。 – rishi
OK、次の回答を確認してください。 –
plzで問題が解決しました。 –