コード例 #1
0
            public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath)
            {
                Book book = null;

                if (indexPath.Section == 0)
                {
                    if (availability == Availability.BOTH || availability == Availability.ONLY_MYBOOKS)
                    {
                        book = myBooks[indexPath.Row];
                    }
                    else
                    {
                        book = availableBooks[indexPath.Row];
                    }
                }
                else
                {
                    book = availableBooks[indexPath.Row];
                }

                if (book != null)
                {
                    PopoverSearchResultView resultView = new PopoverSearchResultView(book, new CGRect(0, 0, RESULT_WIDTH, RESULT_HEIGHT));

                    if (!dictionary.ContainsKey(indexPath))
                    {
                        dictionary.Add(indexPath, resultView);
                    }

                    return(resultView.Frame.Height);
                }

                return(0);
            }
コード例 #2
0
            public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath)
            {
                UITableViewCell cell = tableView.DequeueReusableCell("PopoverSearchIdentifier");

                try
                {
                    if (cell == null)
                    {
                        cell = new UITableViewCell(UITableViewCellStyle.Default, "PopoverSearchIdentifier");
                    }
                    else
                    {
                        foreach (UIView subview in cell.ContentView)
                        {
                            if (subview.Tag == -1)
                            {
                                subview.RemoveFromSuperview();
                            }
                        }

                        cell.BackgroundView = null;
                    }

                    cell.Accessory      = UITableViewCellAccessory.None;
                    cell.SelectionStyle = UITableViewCellSelectionStyle.Default;

                    if (dictionary.ContainsKey(indexPath))
                    {
                        PopoverSearchResultView resultView = dictionary[indexPath];
                        resultView.Tag = -1;
                        cell.ContentView.AddSubview(resultView);
                    }
                }
                catch (Exception ex)
                {
                    Logger.WriteLineDebugging("PopoverSearchDataSource - GetCell: {0}", ex.ToString());
                }

                return(cell);
            }