Monday, 15 August 2011

ios - How to populate collection view with dynamic content -


If the question is a bit unclear then I'm sorry.

The problem I have is: A collection view with I 9 cells. Each cell has a filtered version of UIImage and filter name. For some reasons index 7 (case 7 case) is not used and it looks like index 8 (case 8) has been shown twice.

There are a variety of ways here:

  - (UIImage *) filteredImageFromImage: (UIImage *) image withFilterIndex: (NSUInteger) filterIndex {CIImage * startImage = [CIImage imageWithCGImage: image .CGImage]; // 1 CIContext * context = [CIContext contextWithOptions: zero]; CIFilter * Filters; Switch (filter index) {case 0: filter = [Sathanam of Siaifiltr filters: @ "Siifoitifhafekt noir" Kunjiyaawrvolug: Kesiaiaianaipiaimageki, Arnbakar zero]; break; Case 1: Filters = [name with CIF filter: @ "sephitefthmino" keys and jewelry: kCiINIPI, initialize, zero]; break; Case 2: Filters = [Name with CIF filter: @ "CephotoFFTtonal" keys and values: KCIINIPI, initialize, zero]; break; Case 3: Filter = Zero; break; Case 4: Filters = [CIFF filter filter name: @ "CFofFFFFFED" keys andWishown: ICIINIPI, initialize, zero]; break; Case 5: Filters = [CIFF filter filter name: @ "CFofFixCrom" keys and values: KCIINIPI, initialize, zero]; break; Case 6: filter = [Siaifiltr Filtra Vithanam: @ "Sifotoiffrntprkriya" Kunjianawrvolug: Kesiaiaianaipiaimageki, Arnbakar zero]; break; Case 7: filter = [Siaifiltr Filtrvidthanam: @ "Siifofoiffrnt transfer" Kunjianawrvolug: Kesiaiaianaipiaimageki, Arnbakar zero]; Case 8: filter = [Siaifiltr Filtrvidthanam: @ "Siifoiafifest Instent" Kunjiyaawrvolug: Kesiaiaianaipiaimageki, Arnbakar zero]; break; Default: Filters = Zero; break; } CIImage * outputImage; If (! Filter) {outputImage = startImage; } Else {outputImage = [filter output image]; } // 2 CGImageRef cgimg = [create reference CGIMEZ: OutputEystem Sequence: [Primetime Image]]; // 3 UIImage * newImage = [UIImage imageWithCGImage: cgimg]; // 4 CGImageRelease (cgimg); New image refund; } - Index for NSString * effect name: (NSInteger) index {NSString * name; Switch (index) {case :: name = "" noir "; break; Case 1: name = @ "Mono"; break; Case 2: Name = @ "Tunnel"; break; Case 3: Name = @ "Basic"; break; Case 4: Name = @ "Fade"; break; Case 5: Name = @ "Chrome"; break; Case 6: Name = @ "Process"; break; Case 7: Name = @ "Transfer"; Case 8: name = @ "instant"; break; Default: name = @ "original"; break; } Return name; } #pragma mark - UICollectionViewDataSource - (NSInteger) collectionView: (UICollectionView *) collectionView Snkyaofaitm Insashn: (NSInteger) section {return 9; } - (UICollectionViewCell *) collection: (UICollectionView *) collectionView cellForItemAtIndexPath: (NSIndexPath *) index text {FilterCollectionViewCell * cell = [collectionView dequeueReusableCellWithReuseIdentifier: @ "Filter Display Cell" forIntextPath: indexPath]; PHImageRequestOptions * Options = [[PHImageRequestOptions alloc] init]; Options.synchronous = YES; [[PHImageManager defaultManager] requestImageForAsset: self.firstAsset targetSize: cell.imageView.frame.size contentMode: PHImageContentModeAspectFill Options: Option ResultsHandler: ^ (UIImage * Result, NSDictionary * Info) {if (Results) {cell.imageView.image = [ Self-Filtered ImageFreemz: Results with Filterer Index: indexPath.row]; Cell.nameLabel.text = [index for index of confidence: indexPath.row]; }}]; Cell.layer.cornerRadius = 10.0; Cell.layer.borderColor = [[UIColor colorWithWhite: 1.0 alpha: 0.72] CGColor]; Cell.layer.borderWidth = 2.0; Cell.clipsToBounds = Yes; Return cell; }  

and here is an image of the result:

Enter the image details here

Any help would be greatly appreciated thanks

You have a break in your case; forgot to put in. This is why cell 7 and 8 both show data.


No comments:

Post a Comment