iOS - UITableView - Rows mysteriously repeating themselves when scrolling quickly? (simulator) -


I am currently developing an iOS app using the Monochouch framework.

I have a custom tableview source that uses custom cells, whose cell height is dynamically calculated

When I run the project in the iOS simulator, if I Scroll down quickly or upwards, then the top cell changes down or vice versa - as if it was being mistakenly filmed or wrong cell fault?

Just to clarify - if my cells are

one two three four five

If I scroll up from top to bottom, then my cells

one two three four one

Or if I slowly scroll down, and remain in the cell order, once I'll scroll quickly to the top of me

five two three four five

And if I scroll up and down sporadically, the cells can mix random May include.

My table looks like a source:

  postmodel [] model; String cell identifier = "Feedsell"; Public FeedSource (PostModel [] Item) {Model = Item; } Public override int queues inquiry (UITableView tableview, int section) {Return models. Long; } Public override float GetHeightForRow (UITableView table view, NSIndexPath index path) {FeedCell cell = this.GetCell (table view, index) as FeedCell; Var height = cell.high; Return height; } Public override UITableViewCell GetCell (UITableView table view, MonoTouch.Foundation.NSIndexPath index path) {FeedCell cell = tableView.DequeueResableCell (CellIdentifier) ​​as FeedCell; // If there is no cell to reuse, create a new one (cell == empty) {cell = new feedcall (model [indexPath.Row], new NSString (cell identifier)); Cell.LayoutSubviews (); } //cell.height = cell.height; Return cell; }  

I have heard about performance problems with dynamic cell heights, but I am testing with only 5 cells, and it feels strange.

Is this just my iOS simulator, and it will not be on the device? Is there a fix for this?

Cells are reused whenever possible. If no cell is available ( cell == null ), then to create a new cell ( new FeedCell ), any available cell ( DequeueReusableCell ), / code>).

For this reason, when you create it, you should not pin the contents of a cell. You just need to create a new blank cell.

After you have a cell, you fill the cell with the necessary material on that index path.

  Public override UITableViewCell GetCell (UITableView table view, MonoTouch.Foundation.NSIndexPath IndexPath) {FeedCell cell = tableView.DequeueResableCell (CellIdentifier) ​​as FeedCell; // If there is no cell to reuse, then create a new one (cell == empty) {cell = new feedcall (new NSString (cell identifier)); } Cell.model = Model [indexPath.row]; // Assume that you can do something like cell.layoutSubviews (); Return cell; }  

Comments

Popular posts from this blog

eclipse plugin - Run java code error: Workspace is closed -

ios - How do I use CFArrayRef in Swift? -

scala - Play Framework - how to bind form to a session field -