i create a view based project named myclass.
and i add another UIviewcontroller subclass to it, named as webdata.
In the webdataviewcontroller.m i get image from the webserver.
I need to display this image on imageview in myclassViewController.m from webdataViewController.m
for this my code in webdataViewController.m is
docDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
imagepath = [NSString stringWithFormat:@"%@/image.png",docDir];
logopath = [NSString stringWithFormat:@"%@/logo.png",docDir];
myclassViewController *obj = [[myclassViewController alloc]init];
obj.homeimage.image = [UIImage imageWithContentsOfFile:imagepath];
but image is not displayed,i try to print image in console
NSLog(@"image to display %@",obj.homeimage.image);
NSLog(@"image to display %@",[UIImage imageWithContentsOfFile:imagepath]);
but i get like this
image to display (null)
image to display <UIImage: 0x6f614b0>
why i get null for obj.homeimage.image,i did n’t get can any one please help me.
Thank u in adavance.
(Let me add comment if question is not understandable)
Are you sure that obj.homeimage is not nil? If it is nil then obj.homeimage.image = … will result to setting image property to nil object, that is “nothing”.