Up vote 2 down vote favorite share g+ share fb share tw.
Iphone objective-c cocoa-touch iphone-sdk-4.0 link|improve this question asked Jul 12 '11 at 11:30Ankit36610 80% accept rate.
1 The only answer I can think of here, is UIImageView alloc initWithImage:UIImage imageNamed:@"my_image". Why won't this work for you? – August Lilleaas Jul 12 '11 at 11:34 1 I am downloading images from server.
That images are saved in Document Directory. I want show that images in image view – Ankit Jul 12 '11 at 11:40 Please check my answer. I have provided the sample code also.
It's easy. – AppAspect Jul 12 '11 at 11:41.
Sample code: - (NSString *)applicationDocumentsDirectory { return NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject; } -(void)loadimage{ NSString *workSpacePath=self applicationDocumentsDirectory stringByAppendingPathComponent:@"your image-name"; UIImageView *myimage=UIImageView alloc initWithFrame:CGRectMake(0,0,20,20); myimage. Image=UIImage imageWithData:NSData dataWithContentsOfFile:workSpacePath; self. View addSubView:myimage; myimage release; } TNQ.
Your sample code is for the bundle images. While here we need to get the image from document directory to the image view. – AppAspect Jul 12 '11 at 11:41.
Here you can take UIImageView in your View and add it to the view and do the same like as follows: NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = paths objectAtIndex:0; NSString *imageFilePath; NSError *err; imageFilePath = documentsDirectory stringByAppendingPathComponent:@"image1. Png"; UIImageView *objImageView = UIImageView alloc initWithFrame:CGRectMake(10, 10, 100, 100); objImageView. Image = UIImage imageWithContentsOfFile: imageFilePath; self.
View addSubVIew:objImageView. Image; objImageView release; Please let me know if you still need any help.
You can add the pathe of the imageview and the you can directly add the image to the imageview from that path using this: objImageView. Image = UIImage imageWithContentsOfFile: imageFilePath; – AppAspect Jul 12 '11 at 11:49.
NSArray *directoryPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory,NSUserDomainMask,YES); NSString *imagePath = directoryPath objectAtIndex:0; imagePath= imagePath stringByAppendingPathComponent:@"imagename. Png"; NSData *data = NSData dataWithContentsOfFile:imagePath; UIImage *img = = UIImage imageWithData:data; you can display this image to uiimageview.
You can achieve it, By knowing the names of your images, so while you are storing your image you need to store some information of these images in database,(or some where you can use it), then fetch name of image from data source, and work as follows: NSString *str = NSString stringWithFormat:@"%@. Jpg",myGlobleArrayOfImageNames objectAtIndex:imageCounter; NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *documentsDirectory = paths objectAtIndex:0; NSString *fullImgNm=documentsDirectory stringByAppendingPathComponent:NSString stringWithString:str; mainSlideShowImageView setImage:UIImage imageWithContentsOfFile:fullImgNm.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.