Skip to content

Instantly share code, notes, and snippets.

@MarcBruins
Created October 14, 2017 11:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MarcBruins/dacb8a6c99c774e8234836e302176440 to your computer and use it in GitHub Desktop.
Save MarcBruins/dacb8a6c99c774e8234836e302176440 to your computer and use it in GitHub Desktop.
MyViewSource.cs
public class MyViewSource : MBAutoCompleteViewSource
{
private ICollection<string> _suggestions;
private string _cellIdentifier = "CellId";
public override void NewSuggestions(ICollection<string> suggestions)
{
_suggestions = suggestions;
}
public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
{
UITableViewCell cell = tableView.DequeueReusableCell(_cellIdentifier);
string item = _suggestions.ElementAt(indexPath.Row);
if (cell == null)
cell = new UITableViewCell(UITableViewCellStyle.Default, _cellIdentifier);
cell.BackgroundColor = UIColor.Orange;
cell.TextLabel.TextColor = UIColor.White;
cell.TextLabel.Text = item;
return cell;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment