iphone - tableview 部分标题中的选项卡式导航

标签 iphone ios uitableview code-reuse

我想模仿 pinterest 应用的个人资料页面的行为。

您可以在 Boards/Pin/Likes(表格 View 部分标题)上切换,并且表格 View 会相应更改。

下面是截图来说明这一点。
enter image description here enter image description here

假设我可以在单独的 viewController 中创建每个选项卡(boards/pins/likes)。
还假设我想重用每个 viewController 的代码,因为其他 View (例如选项卡栏上的“跟随”选项卡)看起来非常像其中一个(板/图钉/喜欢)。

我如何共享表格标题和表格部分标题并充分分离代码以便我可以重复使用其中的大部分代码?

基本上,我有两个带 TableView 的 View Controller 。
现在我想创建一个带有 tableView header /节 header 的新 viewController,用户将通过 tab 键查看前两个 viewController 的 View 之一。

最佳答案

我不认为选项卡出现在表头中,相反它可能是 UISegmentedControl 的 View 子类。如果你想重用它,你可以在 xib 文件中创建接口(interface)并将它与你的 View Controller 链接

尝试检查这个 github 项目 https://github.com/rs/SDSegmentedControl用于自定义 UISegmentedControl

关于iphone - tableview 部分标题中的选项卡式导航,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13150844/

相关文章:

iphone - wait_fences : failed to receive reply: 10004003 in UIImagePickerController

iphone - 将十六进制转换为 NSData

iphone - 如何制作基于导航的应用程序?

ios - 子类 uitableviewcell 并覆盖 layoutsubviews

iphone - 选择时动画 UITableViewCell 高度

ios - 测试应用程序时找不到我的 iOS 设备

python - 通过蓝牙在 iOS 应用程序和 Raspberry Pi 之间进行通信

iphone - CGFloats, float 设置为零

ios - 在不使用容器 viewController 的情况下切换 ViewController 的最佳方法是什么?

iphone - 如何做最新的FB UIView 动画?