Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cells are being overwritten in the screen while scrolling V or H #19

Open
sidan opened this issue Mar 4, 2015 · 9 comments
Open

Cells are being overwritten in the screen while scrolling V or H #19

sidan opened this issue Mar 4, 2015 · 9 comments

Comments

@sidan
Copy link

sidan commented Mar 4, 2015

Alright, to start, would like to say this library is a good job and help me a lot as a solution for presenting spreadsheets. Second, would like to know how to solve this issue:

I've made some customization for populate the content within the spreadsheet. But while scrolling, the cells are being drawn above each other, out of order, producing a great mess in the screen.

It goes like this:
screen shot 2015-03-04 at 5 52 56 pm

But when I scroll H or V:
screen shot 2015-03-04 at 5 55 11 pm

Would like to have (please) some clarification about it.

Thanks in advance

@jeffla
Copy link
Contributor

jeffla commented Mar 4, 2015

Rafael,

I haven’t seen that before. Are you sure you don’t have more than 1 spreadsheet view being added to the popup?

This is just a group of UICollectionViews so I’d check to see if something is strange in the delegate calls.

Jeff

@sidan
Copy link
Author

sidan commented Mar 11, 2015

Well, I'm actually using just one spreadsheet inside this viewcontroller but with a slight custom implementation as attached in the code below.

Here is how I'm loading the data source:
screenshot 2015-03-10 21 49 40

...Here, how I'm initializing the spreadsheet:
screenshot 2015-03-10 21 53 03

In the beginning I was assigning the spreadsheet to the main view and the scroll was not working properly, because the spreadsheetview was being drawn out of bounds of main view. Then, I fix it by assigning the spreadsheetview to the child view as its content. At that point, the contents of cells started to be drawn out of order while scrolling.

Really appreciate any help on this!

@jeffla
Copy link
Contributor

jeffla commented Mar 11, 2015

Is initSpreadSheetView being called more then once? Try adding NSLog(@"%s", PRETTY_FUNCTION); at the top of the function and bring it up a few times (looks like it's a view inside of a popup). That method should only fire once. If it's getting called more than once, there is the problem.

@sidan
Copy link
Author

sidan commented Mar 12, 2015

Yes, it's being called just once from viewDidLoad and I could confirm it by logging "PRETTY_FUNCTION". What else it could be? :)

@jeffla
Copy link
Contributor

jeffla commented Mar 14, 2015

Did you try open and closing self.viewProdutoEmProdutos several times so see if the initializer is getting called more than once?

From what you've shown, I don't see a problem.

You might try just using a UICollectionView in place of the spreadSheetView to see if you get the same problem.

@ITDebicki
Copy link

Hi all,
I ran into the same problem when I was using it. It turns out it is a problem with the uicollection view cells not being properly reused.

What I did was every time I added a cell, I removed all its child views.
That fixed it for me.

Here is the code I used:
-(void)resetCell{
for (UIView *view in [self.contentView subviews]) {
[view removeFromSuperview];
}
}

@jeffla
Copy link
Contributor

jeffla commented Apr 10, 2015

@ITDebicki Are you saying this is a UICollectionView issue or something in @sidan 's cell implementation? Perhaps needing to check or destroy the cell's subviews in prepareForReuse?

@ITDebicki
Copy link

I didn't investigate it fully, but I just used this method in the init method of each cell

@sidan
Copy link
Author

sidan commented Apr 10, 2015

@ITDebicki , it seems a nice work around, which I've used so far to reload the view while using this library: https://www.cocoacontrols.com/controls/tstableview that I end up with cuz of project's deadline.
Thanks for supporting..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants