Je souhaite activer Enregistrer l'image et copyr lorsqu'un user touche une image dans une application UIWebView dans mon application. Y at-il une propriété qui permettra cela ou aurai-je besoin d'écrire des methods spéciales pour y parvenir?
Merci d'avoir lu!
UIImage * downloadImage = [[UIImage alloc] initWithContentsOfFile:path]; UIImageWriteToSavedPhotosAlbum(downloadImage,nil, nil, nil); [downloadImage release]; UIAlertView * alert = [[UIAlertView alloc] initWithTitle:@"Saved" message:@"Wallpaper saved to your Gallery." delegate:nil cancelButtonTitle:@"Dismiss" otherButtonTitles:nil, nil]; [alert show]; [alert release]; Add this whole code to your long press method, it will save your image in gallery.
Vous pouvez commencer en créant et en attachant l'instance de UILongPressGestureRecognizer au button.
UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPress:)]; [self.button addGestureRecognizer:longPress]; [longPress release];
Et puis implémentez la méthode qui gère le geste
- (void)longPress:(UILongPressGestureRecognizer*)gesture { if ( gesture.state == UIGestureRecognizerStateEnded ) { NSLog(@"Long Press"); //do something } }