Esempio n. 1
0
        public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
        {
            UITableViewCell cell = tableView.DequeueReusableCell(CellIdentifier);

            if (cell == null)
            {
                cell = new UITableViewCell(UITableViewCellStyle.Default, CellIdentifier);
            }

            CGRect rect = cell.ContentView.Frame;
            UIView selectedBackgroundView = new UIView(cell.Bounds);

            selectedBackgroundView.BackgroundColor = new UIColor((nfloat)(0 / 255.0), (nfloat)(122.0 / 255.0), (nfloat)(255.0 / 255.0), (nfloat)1.0);
            cell.SelectedBackgroundView            = selectedBackgroundView;

            foreach (UIView view in cell.ContentView.Subviews)
            {
                view.RemoveFromSuperview();
            }

            Countries   item      = custom.TemporaryItemSource.GetItem <Countries>((nuint)indexPath.Row);
            UIImageView imageView = new UIImageView(new CGRect(8, 0, 48, 48));
            NSString    imagePath = new NSString("Images/" + (NSString)item.Name);

            imageView.Image = new UIImage(imagePath);
            cell.ContentView.Add(imageView);

            UILabel label = new UILabel(new CGRect(65, 10, rect.Size.Width - 40, rect.Size.Height / 2));

            label.Text = item.Name;
            cell.ContentView.Add(label);

            custom.NormalizeCellText(label, label.Text);
            if (custom.FilterString != null)
            {
                custom.HighlightedSubstring(custom.FilterString, label);
            }

            return(cell);
        }