Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Table Cell reloads after scrolling it out of the View

$
0
0

I've got a TableViewController with a couple custom table cells. I was just playing around with it and I did a bit of scrolling. I noticed when I scroll a TableViewCell outside the View and it reappears that the placeholder text got a bit darker. I think it is because the TableViewCell is reloaded and there are now 2 placeholders on top of each other. I also got a custom table cell with a Switch. When that cell is out of the view and got back in, it takes back the original value (when I put the switch 'off' and scroll it out of the view, it comes back as 'on').

Anyone had this problem before? Why are the TableViewCells reloading when they appear in the View again?

PS. I create the TableViewCells by deserializing a Json file, that is done within the ViewDidLoad() method.

This is my GetCell method:

public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath)
{
    if (element [indexPath.Row].Type == "textField") {

        NSString FieldID = new NSString ("EditField");

        UITableViewCell cell = tableView.DequeueReusableCell (FieldID);

        //Code to fill the textfield table cell

        return cell;
    } 
    if (element [indexPath.Row].Type == "switch") {

        NSString FieldID = new NSString ("SwitchField");

        UITableViewCell cell = tableView.DequeueReusableCell (FieldID);

        //Code to fill switch table cell

        return cell;
    }
}

Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>