UITableView中的iOS自定义页脚视图问题

问题描述 投票:-1回答:2

我正试图为UITableView制作页脚视图,但我正面临这些问题

  1. 首先,我不知道如何为UITableView制作页脚视图。我知道我可以在Nib中单独进行设计。所以我做到了。现在我不知道如何加载该页脚作为UITableView粘性页脚。
  2. 我的页脚将有2个子视图,这些视图是TextFieldButton
  3. 通过在页脚中使用TextField会出现问题,因为键盘会掩盖它们,用户将无法看到他正在键入的内容。

请告诉我怎么办?

ios uitableview viewcontroller
2个回答
0
投票
  1. 使用此数据源显示页脚 - > tableView(_:viewForFooterInSection:)
  2. 首先根据您的要求创建您的设计a / c并返回上述代表。
  3. 要摆脱这个问题,你可以使用IQKeyboardManager。它会自动管理键盘的布局。

0
投票
func tableView(_ tableView: UITableView, viewForFooterInSection section: Int) -> UIView? {

    let footerView = tableView.dequeueReusableCell(withIdentifier: "FooterView") as! FooterTableViewCell

    return footerView
}

func tableView(_ tableView: UITableView, heightForFooterInSection section: Int) -> CGFloat {
    return 100
}
© www.soinside.com 2019 - 2024. All rights reserved.