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

MvxActionBasedBindableTableViewSource.GetOrCreateCell For in MonoTouch #57

Closed
Fundevil opened this issue Nov 20, 2012 · 5 comments
Closed
Labels
t/bug Bug type

Comments

@Fundevil
Copy link

Hi,
it seems, that MVVMCross is not using the possibility of reusing cells in iOS UITableView, if I'm using the MvxActionBasedBindableTableViewSource.

In GetOrCreateCell method MVVMCross is trying to get a cached cell with tableView.DequeueReusableCell(CellIdentifier), but the CellIdentifier is not the one given in the constructor, but the const NSString("MvxDefaultBindableTableViewCell"). So it will never find a cell to reuse.

You can reproduce this with your Sponsors Table in the conference demo.

To check if it is working at all, I had set the ReusableIdentifier of my cell to "MvxDefaultBindableTableViewCell". So the reusing is working properbly, but now binding is not working as expected anymore. The cell will only be refreshed, once it is scrolled out of sight and back in.

Can you give me a hint, how to get both working ? Reusing of cells and the direct refresh ?

Greetings Oliver

@slodge
Copy link
Contributor

slodge commented Nov 20, 2012

Thanks for the report

Is a fix for this as simple as the MvxActionBasedBindableTableViewSource also provinding a mechanism to override the CellIdentifier call too?

In the slightly longer term I'd also want to look at moving CellIdentifier to be a virtual property in the base table source class.

Will look at this more later

Stuart

@slodge
Copy link
Contributor

slodge commented Nov 20, 2012

Something like https://gist.github.com/4119401 - but won't test properly until much later tonight!

@Fundevil
Copy link
Author

Hi, thanks for the quick reply.

I have just done a quick test, and now the cells are reused as expected. Thanks.

But my second problem still exist: Without the patch, I could update the Datasource and the uitablecell directly updates the view via binding. Now I have to scroll the cell out of sight and back to refresh the content.

Greetings

Oliver

@slodge
Copy link
Contributor

slodge commented Nov 20, 2012

I think you'll maybe need to look at the cell code to force it to redraw - try adding code like SetNeedsLayout and SetNeedsRedraw - see http://stackoverflow.com/questions/950769/how-to-refresh-uitableviewcell and lots of other qu's
e.g. your property might become

public string Title
{
get { return _titleLabel.Text; }
set { _titleLabel.Text = value; SetNeedsLayout(); }
}

slodge added a commit that referenced this issue Nov 20, 2012
@slodge
Copy link
Contributor

slodge commented Nov 23, 2012

Thanks for the report.

ActionBased problem fixed in both master and vnext.

If there's more on the SetNeedsRedraw issue, then please let me know... either here (reopen) or u=in a new issue.

Closing for now.

@slodge slodge closed this as completed Nov 23, 2012
martijn00 added a commit to martijn00/MvvmCross that referenced this issue Dec 8, 2016
kjeremy pushed a commit to kjeremy/MvvmCross that referenced this issue Dec 11, 2016
Update MvxCachingFragmentActivityCompat.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
t/bug Bug type
Development

No branches or pull requests

2 participants