Wednesday, 15 April 2015

ios - Loading UIImage from Directory no longer working -



ios - Loading UIImage from Directory no longer working -

for past 5 or 6 months have been saving images photos folder in created within documents directory on users device. photos loaded imageview when user entered specific screen, until has been working perfectly.

now images no longer show in image view , when using url print out image width , height, values 0 though url has not changed.

i using next code display image within image view.

outputimageview = [[uiimageview alloc] init]; [outputimageview setframe:originalimageviewsize]; outputimageview.image = [uiimage imagewithdata:[nsdata datawithcontentsoffile:photourl]]; nslog(@"width %f, height %f", outputimageview.image.size.width, outputimageview.image.size.height);

the photourl follows: /users/fernandosantos/library/developer/coresimulator/devices/6f3fce2a-f7f9-4f77-b66d-3da2a25be166/data/containers/data/application/c3867efa-6aa8-4b71-a856-dcf7f83deff0/documents/audibury/photos/commtrcial-csrsignature--2014-10-13 10-49-16.jpg

thanks

in ios8 application documents directory dynamically changes name on every running. have utilize next method appdelegate in order current documents directory path:

// returns url application's documents directory. - (nsurl *)applicationdocumentsdirectory { homecoming [[[nsfilemanager defaultmanager] urlsfordirectory:nsdocumentdirectory indomains:nsuserdomainmask] lastobject]; }

you should save relative path of file, not total path. method works on ios7.

you can utilize ios simulator , check total path doesn't exist.

ios

No comments:

Post a Comment