autolayout - CollectionView freeze when height is not fixed IOS -


i using autolayout calculate height of uicollectionview. whenever sizeforitematindexpath called, uicollectionview freezes.

here code

  - (cgsize)collectionview:(uicollectionview *)collectionview layout:(uicollectionviewlayout*)collectionviewlayout sizeforitematindexpath:(nsindexpath *)indexpath  {      cgfloat height;      if ([alertheightdict objectforkey:indexpath]) {         height = [[alertheightdict objectforkey:indexpath] floatvalue];     }else{         //[[logclass sharedinstance] log:[nsstring stringwithformat:@"offscreencells %@", self.offscreencells]];         //notificationcustomcell *cell = [self.offscreencells objectforkey:indexpath];         notificationcustomcell *cell = [[notificationcustomcell alloc] init];//my custom cell         nsmutabledictionary *datasourceitem = [alertsarray objectatindex:indexpath.row];// source array         [cell updatecell:datasourceitem :indexpath.row : 0];// updating cell          [cell setneedsupdateconstraints];         [cell updateconstraintsifneeded];          cell.bounds = cgrectmake(0.0f, 0.0f, cellwidth, cgrectgetheight(cell.bounds));          [cell setneedslayout];         [cell layoutifneeded];          height = [cell.contentview systemlayoutsizefittingsize:uilayoutfittingcompressedsize].height;         [alertheightdict setobject:[nsstring stringwithformat:@"%f", height] forkey:indexpath];     }      return cgsizemake(cellwidth , height);    }   

is wrong here freezes app


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -