如何将按钮放在UITableView上,不会在iOS中滚动表格 [英] How to put buttons over UITableView which won't scroll with table in iOS

查看:73
本文介绍了如何将按钮放在UITableView上,不会在iOS中滚动表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将按钮放在 UITableView 上,它们保持在屏幕的同一位置,不会滚动 UITableView 。当我尝试 addSubview 按钮时,它们会显示但是滚动 UITableView

I want to put buttons over UITableView which stays on same position of screen, won't scroll with UITableView. When I tried to addSubview buttons, they are displayed but scrolls with UITableView.

将按钮放在 UITableView 上的原因是让用户对其进行操作。我不是在谈论在单元格中使用按钮。它们是浮动按钮,从不移动它们的位置。

Reason to put buttons over UITableView is to let user operate some action on it. I'm not talking about having buttons in cell. They are floating buttons which never moves their position.

我正在使用 UITableViewController ,我不想要为此目的使用页眉或页脚。另外一些酒吧(例如 UIToolbar )对我来说不是一个选项。

I'm using UITableViewController, and I don't want to use header or footer for this purpose. And also another some bar (UIToolbar for instance) is not an option for me.

提前致谢。

推荐答案

一个解决方案是扩展 UIViewController 而不是的UITableViewController 。您需要添加自己的表视图并设置所有内容。然后,您可以将按钮添加到视图控制器的视图而不是表视图。

One solution to this is to extend UIViewController instead of UITableViewController. You will need to add your own table view and set everything up. Then you can add your button's to the view controller's view instead of the table view.

这篇关于如何将按钮放在UITableView上,不会在iOS中滚动表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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