ios - Swift 3 管理部分标题的标题

标签 ios swift uitableview

我有一个 viewController 作为

class MyController: UIViewController , UITableViewDelegate, UITableViewDataSource, UISearchBarDelegate 

我使用 Storyboard设置数据源和委托(delegate) 在这个类中,我已经实现了这些方法:

  1. tableView titleForHeaderInSection
  2. tableView sectionForSectionIndexTitle
  3. sectionIndexTitles.

我想实现一个与联系人应用具有相同行为的应用。 但问题是部分标题似乎与列表分离,如果我滚动列表部分标题不会滑动...

enter image description here

任何帮助将不胜感激 谢谢

最佳答案

是一个约束问题,我使用 StackView 解决了这个问题。我将 SearchBar 和 UITableView 放在 StackView 中,这样我就得到了垂直对齐。现在开始工作了。 enter image description here

关于ios - Swift 3 管理部分标题的标题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39529787/

相关文章:

ios - 对所有实例变量编码标准使用@properties

ios - 如何使用 SpriteKit 替换背景图像?

Swift 4 在 UITableViewCell 中禁用 UIButton 的正确方法

ios - UITableViewCell 中的 UISwitch 和 UIButton,如何识别它们

iphone - UITableViewCell 帮助中的 UITextField

objective-c - Objective C > UITableViewCell 按钮不按下

ios - 绕圈旋转

iphone - 如何以编程方式构建本地化日历月份名称的 NSArray?

ios - 快速隐藏栏按钮项目

ios - 超出范围,线程问题