开发者

how to save image and data locally in iphone device

I am getting image and some details from .net web server.

I need to store these details in iphone device memory(not in sdcard),Because I need to connect web services only one time,that is at installing my app.

From Next time onwards i need to get data from device.

I have some knowledge in java,In java i use files to store image and Hash table to store details.

i found this to store image

it shows path

/Users/appleuser/Library/Application Support/iPhone Simulator/4.0.1/Applications/14ED40D5-321E-4519-BDEA-77757589F8F7/Documents

But is it save in device or on开发者_StackOverflowly in notebook.

How can i done this in iphone.

can any one pls help me.

Thank u in advance.


HI,

Have u tried this method

UIImageWriteToSavedPhotosAlbum(image, self, (SEL)@selector(Imageview.image:didFinishSavingWithError:contextInfo:), nil); 


If you want to save the image to your device Photo Album

UIImageWriteToSavedPhotosAlbum(image, self, @selector(imageSavedToPhotosAlbum: didFinishSavingWithError: contextInfo:), context); 

Finally to know the save is Successful or not use this method

- (void)imageSavedToPhotosAlbum:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo {
        NSString *message;
        NSString *title;
        if (!error) {
        title = NSLocalizedString(@"SaveSuccessTitle", @"");
        message = NSLocalizedString(@"SaveSuccessMessage", @"");
        }
 else {
        title = NSLocalizedString(@"SaveFailedTitle", @"");
        message = [error description];
      }
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:title 
                                           message:message
                                           delegate:nil
                                           cancelButtonTitle:@"OK"
                                           otherButtonTitles:nil];
                                           [alert show];
                                           [alert release];

}

Otherwise If you are retriving large number of data(such as images etc.), you can implement Coredata in your project to do further complex operations.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜