Note that there are some explanatory texts on larger screens.

plurals
  1. POUICollectionView images/data our of order
    text
    copied!<p>I am using Storyboard to create the UICollectionViewController - CollectionView - Cell(my own DasboardsViewCell) and my customer view (DashBoardView) inside cell. I wired up everything correctly and everything seems to work except when I scroll up and down. I will explain what my understanding is after I debug. </p> <p>Also I have 2 views inside my DashBoardView custom view which i used "one" as main primary and other as FlipView (e.g. when user taps on cell). Since everything is wired from storyboard I dont have to registerClass for reusing.</p> <p>1) In my DashboardCustomView (who has 2 other views in it as above) i do this</p> <pre><code>- (id)initWithCoder:(NSCoder *)aDecoder { self = [super initWithCoder:aDecoder]; if (self) { _isPrimary = YES; //to init my 2 child views and insert to main custom view [self initSubViewsWithInsert]; } return self; </code></pre> <p>}</p> <p>2) In my DashBoardViewCell class I do this</p> <p>@synthesize dashBoardView = _dashBoardView;</p> <pre><code>- (id)initWithCoder:(NSCoder *)aDecoder { self = [super initWithCoder:aDecoder]; if (self) { self.backgroundColor = [UIColor colorWithWhite:0.75f alpha:0.6f]; self.layer.borderColor = [UIColor blackColor].CGColor; self.layer.borderWidth = 2.0f; self.layer.cornerRadius = 7.0f; } return self; } // If I dont do this below I get overlapped images and data on cell when scrolling up and down - (void)prepareForReuse { self.dashBoardView.mainContainerView = nil; self.dashBoardView.flipView = nil; } </code></pre> <p>3) Now after this I still see the custom view appears out of order and seems somewhat better than not doing "nil" on my views, but the problem is once I nil out my 2 subviews I have no defined way to reinitialize them when my collectionview controller requeus the cell and start adding my content. </p> <p>i.e. I do like this cellForItemAtIndexPath</p> <pre><code>if ([cell isKindOfClass:[DashboardsViewCell class]]) { DashboardsViewCell *dashCell = (DashboardsViewCell*) cell; Dashboard* tmpDashboard = self.availableDashBoards[indexPath.item]; [dashCell.dashBoardView addDashboardImageViewAtPoint:tmpDashboard.identifier usingIndexPath:indexPath]; </code></pre> <p>Last line above is adding some image and text on dashboards main view which is self.dashBoardView.mainContainerView and it has already nil.</p> <p>Can someone help me understand if there is defined way to do this. Also if you think I am looking at wrong problem</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload