1

I am Using SOAP WS for getting the Data. I got the four Parameters in Response - Topic_Name, Topic_Id, Topic_ImagePath and Topic_Details. Now I have All the Images of Topic Locally with the same name as i got from the web service for Particular Topic_ID.

My question is I want to use Local image instead using the Topic_ImagePath 's Image but the data Must Come From the Web Service.

I dont want to use if ..else condition because I have more than 1000 Topics, any one can explain how I get the Path of Local Image and Display it with the Data Comes From the Web Service..

Thanx in Advance.

3 Answers 3

0

If you have stored images with same name locally. Then you can substring of name of image from the imagepath you are getting from server and show it in UIImageview from the local images.

1
  • thanx ..got your Idea and get the required Local image with my web service data..
    – Dishant
    Jul 1, 2011 at 8:47
0

Store images locally using name scheme something like Topic_ID_ImageName. Search for that Image locally if it is available else use Topic_ImagePath 's Image

0

If you can get the image name from the string you get from the webservice, and the image is added to your project you can use [UIImage imagenamed: @"imagename"] to get the image.

If it is stored on your device and you know the location but it is not part of your project you can use the following code:

NSString *imageName = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.png", imagename]];
        if ([[NSFileManager defaultManager] fileExistsAtPath:imageName] == TRUE) {
            _storeImage = [[UIImage alloc] initWithContentsOfFile:imageName];
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.