Skip to content
This repository

Allow customisation of each cell in a Section before its used #180

Closed
wants to merge 1 commit into from

2 participants

Nic Wise Miguel de Icaza
Nic Wise

this came out of my Evolve talk.

Allows a Section to customise its elements before they are used - so you can change the background of the element correctly without changing how the element works.

Another way could be to make the Section implement an interface like IElementResizing, not sure if an otherwise blank method call is quicker/better than a "if (x is ISectionCustomisation)" type call. Happy to rework if it is.

Should have submitted this a year ago. :(

Nic Wise nicwise Added to DVC and Section to allow each cell in a section to be custom…
…ized before it's used. Allows for consistent changes to a section, eg changing the background image
1489738
Miguel de Icaza
Owner

Is this related to one of the questions that folks asked at Evolve?

Nic Wise
Miguel de Icaza
Owner

So this kind of customization should be done by a subclass of the source, there is no need to add this directly to the source code.

You are going from having to customize the internal data source, to having to customize a Section subclass. Small gain, but one that impacts every cell.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Apr 21, 2013
Nic Wise nicwise Added to DVC and Section to allow each cell in a section to be custom…
…ized before it's used. Allows for consistent changes to a section, eg changing the background image
1489738
This page is out of date. Refresh to see the latest.
2  MonoTouch.Dialog/DialogViewController.cs
@@ -338,7 +338,7 @@ public override UITableViewCell GetCell (UITableView tableView, MonoTouch.Founda
338 338 var section = Root.Sections [indexPath.Section];
339 339 var element = section.Elements [indexPath.Row];
340 340
341   - return element.GetCell (tableView);
  341 + return section.CustomizeCell(element.GetCell (tableView), indexPath);
342 342 }
343 343
344 344 public override void WillDisplay (UITableView tableView, UITableViewCell cell, NSIndexPath indexPath)
6 MonoTouch.Dialog/Elements.cs
@@ -2343,6 +2343,12 @@ public override UITableViewCell GetCell (UITableView tv)
2343 2343
2344 2344 return cell;
2345 2345 }
  2346 +
  2347 + public virtual UITableViewCell CustomizeCell(UITableViewCell source, NSIndexPath indexPath)
  2348 + {
  2349 + return source;
  2350 + }
  2351 +
2346 2352 }
2347 2353
2348 2354 /// <summary>

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.