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

查看:12
本文介绍了如何将按钮放在 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天全站免登陆