Reputation: 384
My app contains some images which needs to be dynamically loaded from web server through XML file. Every time when changes done in admin console at web server it should reflect in iPhone app too through the XML file. I wrote XML file but dont know how to get used in iPhone code. I referred the following links,
how-to-retrieve-data-through-xml-in-iphone-locally-file
dynamically-pulling-images-from-xml-for-iphone-app
how-to-change-the-tabbaritem-images-dynamically-in-iphone-app
retrieving-images-to-iphone-app-through-xml
but all these links are not clear for me to understand. Kindly suggest me a way to do it.
Upvotes: 1
Views: 624
Reputation: 2576
So I assume your web server can serve an XML which includes the image in some encoded format like base64. Then you need to:
NSURLConnection
, e.g. as described in how-to-make-http-request-from-iphone-and-parse-json-resultNSString
and you want to have its binary representation as NSData
. NSData
has some convenience functions for this. E.g. for base64, there is the dataFromBase64String:
constructor.UIImage
using the imageWithData:
constructor. UIImageView
and assign to it your UIImage
. Set the frame of the view and add it to your preferred subview.It is also possible that the XML provides URLs where to get the image data. Then you have to do a new request. This should be clear by now, how to do.
Good luck.
Upvotes: 1