Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 如何在UITableView中添加两个单元格之间的间距?那里';It’这和分隔带的高度什么的没什么两样_Ios_Xamarin_Xamarin.ios - Fatal编程技术网

Ios 如何在UITableView中添加两个单元格之间的间距?那里';It’这和分隔带的高度什么的没什么两样

Ios 如何在UITableView中添加两个单元格之间的间距?那里';It’这和分隔带的高度什么的没什么两样,ios,xamarin,xamarin.ios,Ios,Xamarin,Xamarin.ios,我需要一个布局像在附加的图像。我曾尝试在UICell的底部添加一个子视图,但它实际上扭曲了UI中的其他项。有人能帮忙吗?我在Xamarin.iOS工作 一个选项是使用节和节尾: override func numberOfSections(in tableView: UITableView) -> Int { return 5 } override func tableView(_ tableView: UITableView, numberOfRowsInSection sec

我需要一个布局像在附加的图像。我曾尝试在UICell的底部添加一个子视图,但它实际上扭曲了UI中的其他项。有人能帮忙吗?我在Xamarin.iOS工作


一个选项是使用节和节尾:

override func numberOfSections(in tableView: UITableView) -> Int {
    return 5
}

override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return 1
}

override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
    // your spacing
    return 20
}

override func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
    let footer = UIView()
    footer.backgroundColor = .clear
    footer.isOpaque = false
    return footer
}

一个选项是使用节和节页脚:

override func numberOfSections(in tableView: UITableView) -> Int {
    return 5
}

override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    return 1
}

override func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
    // your spacing
    return 20
}

override func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {
    let footer = UIView()
    footer.backgroundColor = .clear
    footer.isOpaque = false
    return footer
}

一种选择是将单元设计为xib


一种选择是将电池设计为xib


我通常看到的推荐方法是在每个UITableViewCell底部的间隔视图。如果这种方法“拉伸”你的UI,听起来好像有些约束是错误的,或者你使用了不正确的固定高度。我通常看到的推荐方法是在每个UITableViewCell底部的间隔视图。如果这种方法“拉伸”您的UI,听起来好像有些约束是错误的,或者您使用的固定高度不正确。如果您使用。xibst非常感谢:)这是一个好主意,但实际上我没有使用。xibs。您也可以在代码中创建相同的效果。将作为子视图添加到contentView,并使用前导、尾随、顶部和底部约束创建填充。在图像中考虑到灰色区域在内容视图中,这绝对是最简单的方法。如果你正在使用。XBSs非常感谢:这是一个好主意,但实际上我不使用.XBs。你也可以在代码中创建相同的效果。将作为子视图添加到contentView,并使用前导、尾随、顶部和底部约束创建填充。在图像提供考虑灰色区域在内容视图感谢它为我工作:谢谢它为我工作: