Twitter iOS配置文件页面配置 [英] Twitter iOS Profile Page Configuration

查看:135
本文介绍了Twitter iOS配置文件页面配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试构建类似于Twitter的个人资料页面的页面。看起来他们使用的是基本的 UITableView 。顶部配置文件只是tableHeaderView。选项卡是SectionRowHeader中的 UISegmentedControl ,以便在滚动时粘到顶部。而推文只是该部分内的细胞。如果你切换标签,似乎他们只是更改底层数据并重新加载表。

I'm trying to structure a page similar to Twitter's profile page. It looks like they are using a basic UITableView. The top profile is just the tableHeaderView. The tabs are a UISegmentedControl inside the SectionRowHeader so that it sticks to the top when scrolled. And the tweets are just the cells inside that section. And if you switch tabs, it seems like they are simply changing the underlying data and reloading the table.

但是如果您使用该页面,您会注意到更改标签会保留上一个滚动位置。如果您在一个选项卡上滚动回顶部,那么当然另一个选项卡必须滚动到顶部,否则它将在标题下方滚动。此外,如果仔细观察,一旦开始滚动,底部(推文)就会有自己的滚动条。所以看起来这就是它自己的tableview。那么这将是主页单元格内的新表视图吗?如果这就是他们正在做的事情,那么滚动在他们之间是无缝的。您可以向上滚动底部,只有当标签固定到顶部时,推文才能在其下方滚动。

However if you play with the page, you'll notice that changing tabs keeps the previous scroll position. And if you scroll back to the top on one tab, then of course the other tab has to be scrolled to the top otherwise it'll be scrolled underneath the header. Also, if you look closely the bottom part (the tweets) has its own scrollbar once you start scrolling. So it seems like that is its own tableview. So would that be a new tableview inside the cell of the main page? And if that's what they're doing, then the scrolling is seamless between them. You're able to scroll the bottom part up and only once the tabs are pinned to the top do the tweets scroll underneath it.

我正在尝试构建一个类似的结构化页面,但一直遇到问题。理想情况下,我还希望将这些子选项卡的逻辑分解为单独的视图控制器以供重用,但此时我只想让它工作。

I'm trying to build a similar structured page but keep running into issues. Ideally I would also like to have the logic of those sub tabs broken out into separate view controllers for reuse but at this point I would just like to get this working.

任何人知道他们用来设置这样一个页面的结构吗?

Anyone have any idea of the structure they're using to setup a page like this?

推荐答案

我99%肯定他们是滚动查看表时只需调整滚动指示符插入:

I'm 99% certain they are simply adjusting the scroll indicator insets as you scroll view the table:

- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
    CGFloat const visibleHeaderHeight = 0.0; // your logic here
    UIEdgeInsets const insets = UIEdgeInsetsMake(visibleHeaderHeight, 0.0, 0.0, 0.0);

    self.scrollView. scrollIndicatorInsets = insets;
}

此外,我很确定他们使用的是分组式样式表视图切片,所以你需要自己构建粘性标题。您也可以在 -scrollViewDidScroll:中执行此操作。

Also I'm pretty sure they are using a grouped style table view due to the sectioning, so you would need to build the sticky header yourself. You can also do that in -scrollViewDidScroll: though.

如果你想将标签分成单独的视图控制器,我建议进行以下设置:

If you want to break the tabs into separate view controllers, I would recommend the following setup:


  • 有一个容器视图控制器来管理标题视图包含选项卡

  • 使用 UIViewController 包含以插入活动视图控制器

  • 订阅活动视图控制器的滚动视图的 contentOffset 并相应地调整滚动指示符插入和粘贴标题y位置

  • have a container view controller managing the header view containing the tabs
  • use UIViewController containment to plug in the active view controller
  • subscribe to the active view controller's scroll view's contentOffset and adjust the scroll indicator inset and sticky header y position accordingly

这篇关于Twitter iOS配置文件页面配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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