ios - UICollectionView doesn't display any image -


I am trying to display the image from the document directory in the UICollectionView, everything is fine but no image is visible. - View (zero) viewsDidload {[Super Viewedload]; // Start Recipe image array NSArray * path = NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, yes); NSString * document directory = [path item overindexx: 0]; NSArray * dirContents = [[NSFileManager Default Manager] Contentoff DirectoryAct Path: Document Directory Error: Zero]; NSMutableArray * image = [NSMutableArray array]; (For dirContents in NSString * tirring) {if ([tString hasSuffix: @ ". Png"]) {[image addObject: tString]; ListeImages = [NSArray arrayWithArray: image]; }}} - (NSInteger) collectionView: (UICollectionView *) collectionView NumberOffAd Insights: (NSInteger) section {return listeImages.count; } - See the (UICollectionViewCell *) collection: (UICollectionView *) collectionView cellForItemAtIndexPath: (NSIndexPath *) index path {static NSString * identifier = @ "cell"; UICollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier: identifier forIndexPath: indexPath]; UIImageView * listeImageView = (UIImageView *) [cell visualization: 100]; UILabel * LabelView = (UILabel *) [cell view details: 110]; LabelView.text = [listeImages objectAtIndex: indexPath.row]; ListeImageView.image = [UIImage imageNamed: [listeImagesObjectAutandx: indexPath.row]]; NSLog (@ "List UIImageView listeIgeView.image% @", listeIgeView.image);

cell.backgroundColor = [UIColor redColor];

  Cells. Background view = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @ "photo frame .png"]]; NSLog (@ "List NSArray * liste images% @", list images); Cell.tag = indexPath.row; Return cell; }   

With this piece of code, the correct UICollectionView displays UILabel, but no image is displayed.

I use the code to store my image in listeImageView. Image. UIImageView * listeImageView = (UIImageView *) [Cell ViewViewGuet: 100]; ListeImageView.image = [UIImage imageNamed: [listeImagesObjectAutandx: indexPath.row]];

Here are the results of my NSLog:

  2014-10-11 09: 46: 31.117 imgap [2803: 60b] List NSArray * ListeImages; ("Image10102014233607.png", "image10102014233616.png", "image10102014233627.png") 2014-10-11 09: 46: 31.158 IMGAPP [2803: 60b] List UIIMAge listIIMAJEWIs (empty) 2014-10-11 09: 46: 31.171 IMGAPP [2803: 60B] List UIIMAgeVision listImageViIiIs (empty) 2014-10-11 09: 46: 31.178 IMGAPP [2803: 60B] List UIIMAGEView listImageViIiIs (empty)   

You are below,

/ P> < Previous> listeImageView.image = [UIImage imageNamed: [listeImages objectAtIndex: indexPath.row]];

But your is doing,

  cell. Background view = [[UIImageView alloc] initWithImage: [UIImage imageNamed: @ "photo-frame.png"]];   

Why not use your listeImageView below: -

  cell.backgroundView = listeImageView;   

This should take you an image.

UPDATE : -

 For  (in NSString * tString DirContents) {if ([tString hasSuffix: @ ".png"]) {** [Image addObject: [UIImage imageWithContentsOfFile: tString]]; // Do the bottom line as if you were unable to create an image object, which you are trying to achieve. Also check your image array for ** // object, whether it is stored or not. // [image addObject: tString]; }} ListeImages = [NSArray arrayWithArray: image]; // After adding all the objects to your image mutable and do so, not for the loop, because it will start a lot depending on the number of your loop running.    

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -