2014-09-24 59 views
1

僅在iOS 8上滾動時,我的行纔會彼此重疊。我嘗試了與iOS 7有關的類似主題的修復,但我沒有解決我的問題。請參閱附加圖像和我的UITableView GetCell方法。我使用MonoTouch,但邏輯與objective-c相同。iOS 8 TableView在滾動後重疊行

enter image description here

public override UITableViewCell GetCell (UITableView tableView, NSIndexPath indexPath) 
     { 
      UITableViewCell cell = null; 
      cell = tableView.DequeueReusableCell(CELL); 

      if (cell == null) 
       cell = new UITableViewCell(UITableViewCellStyle.Default, CELL); 

      if (cell.ContentView.Subviews.Length > 0) 
       cell.ContentView.Subviews[0].RemoveFromSuperview(); 

      UIView backgroundView = new UIView(); 
      cell.SelectedBackgroundView = backgroundView; 

      if (list[indexPath.Row] != null) 
      { 
       cell.ContentView.AddSubview(list[indexPath.Row].View); 
      } 
      return cell; 
     } 
+0

if(cell.ContentView.Subv iews.Length> 0)爲什麼你需要這個如果功能? – Bejibun 2014-09-24 01:39:10

+0

好問題。另一位開發人員將其納入考慮。我猜想只是一個完整的檢查。 – wheels53 2014-09-24 17:37:02

回答

0

這可能是許多無謂的錯誤之一,從建立在Xcode中6試試這個在viewDidLoad中功能:

YourTableView.rowHeight = ##; //write your desired height. 

如果這不工作,也嘗試實施您的tableview的heightForRowAtIndexPath函數:

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    return ##; //write your desired height 
} 
+0

不幸的是,上下滾動時,行仍然重疊。 – wheels53 2014-09-24 17:38:09

+0

您可以嘗試刪除tableview,將其放回並重新掛接所有連接。如果上述答案無效,這可能會解決它。 – Gabriel 2014-09-24 17:43:15

+0

不行。我刪除並重新添加一個新的表視圖,但我得到同樣的問題。一切都佈置完美,直到我滾動視圖並回到視圖。 – wheels53 2014-09-24 20:52:09