iOS 8 TableView在滚动后重叠行 [英] iOS 8 TableView overlaps rows after scrolling

查看:134
本文介绍了iOS 8 TableView在滚动后重叠行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

仅在iOS 8上滚动时,我的行相互重叠。我尝试了与iOS 7相关的类似主题的修复,但我还没有解决我的问题。请参阅附图和我的UITableView GetCell方法。我使用的是MonoTouch,但其逻辑与objective-c相同。

Only on iOS 8 and when scrolling do my rows overlap each other. I tried the fixes for similar topics related to iOS 7 but I haven't solved my issue. Please see attached image and my UITableView GetCell method. I'm using MonoTouch but the logic is the same as objective-c.

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;
        }


推荐答案

这可能是其中之一在Xcode 6上构建许多无意义的错误。在viewDidLoad函数上试试这个:

That might be one of the many senseless bugs from building on Xcode 6. Try this on the viewDidLoad function:

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

如果这不起作用也尝试为你的tableview实现heightForRowAtIndexPath函数:

if this doesn't work also try implementing the heightForRowAtIndexPath function for your tableview:

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

这篇关于iOS 8 TableView在滚动后重叠行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆