Created
October 14, 2017 11:13
-
-
Save MarcBruins/dacb8a6c99c774e8234836e302176440 to your computer and use it in GitHub Desktop.
MyViewSource.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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