我們創(chuàng)建了一個 TableViewController 以便用戶可以啟用/禁用不同的通知類型。初始加載后,一切都很好,直到用戶滾動到底部然后回到頂部并且前 1-2 個表格視圖單元格未正確顯示。示例: https ://imgur.com/7n2VpTo通常刪除并重新創(chuàng)建視圖控制器和 xib/cs 文件可以修復(fù)此問題,但想知道是否有人知道此問題的原因??刂破鞔a: public override nfloat GetHeightForRow(UITableView tableView, NSIndexPath indexPath) { return 305; } public override nint NumberOfSections(UITableView tableView) { return 1; } public override nint RowsInSection(UITableView tableView, nint section) { return _numRows; } public override UITableViewCell GetCell(UITableView tableView, NSIndexPath indexPath) { var cell = tableView.DequeueReusableCell(Setting.Key) as Setting; if (cell == null) { var values = _settings.Where(s => s.Index == indexPath.Row).FirstOrDefault(); cell = new Setting(values); var views = NSBundle.MainBundle.LoadNib(Setting.Key, cell, null); cell = Runtime.GetNSObject(views.ValueAt(0)) as Setting; } cell.SelectionStyle = UITableViewCellSelectionStyle.None; cell?.PopulateData(_settings.Where(s => s.Index == indexPath.Row).FirstOrDefault(), this); return cell; } public override void ViewWillLayoutSubviews() { base.ViewWillLayoutSubviews(); }
UITableViewCell 未正確呈現(xiàn)
30秒到達戰(zhàn)場
2022-12-24 14:41:41