iPad UI 版 Twitter - 它是如何工作的?

发布于 2024-09-25 11:49:53 字数 178 浏览 3 评论 0原文

iPad 版 Twitter 引入了一种新的内容浏览方式。有人猜测这些滑动面板是如何管理的吗?它是一个很大的UIScrollView,里面有一堆UITableViews吗?或者一堆 UIViewControllers 在彼此之上滑动?还是别的什么?你的赌注是什么?

Twitter for iPad introduced a new way of browsing content. Does anyone have a guess of how these sliding panels are managed? Is it one big UIScrollView with a bunch of UITableViews in it? Or a bunch of UIViewControllers sliding on top of each other? Or something else? What's your bet?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

爱的十字路口 2024-10-02 11:49:53

我认为这里的技巧不在于使用的视图类型,而在于它们的定位和动画。当各种面板滑入和滑出时,我认为它们正在使用类似 CAKeyframeAnimations 之类的东西,这些动画通过 UIGestureRecognizer 的实现来激活。

对于垂直滚动,他们使用 UIScrollView,但对于水平滚动,以上是我的赌注。

I think the trick here isn't in the view types used, but rather in the positioning and animating of them. When various panels slide in and out, I think they're using something like some CAKeyframeAnimations that activate through an implementation of UIGestureRecognizer.

For vertical scrolling they're using UIScrollView, but for horizontal scrolling, the above is my bet.

情深已缘浅 2024-10-02 11:49:53

使用我在 GitHub 上的项目 FRLayeredNavigationController,您可以轻松开发与 Twitter iPad 应用程序非常相似的 UI。还有一篇关于它的博客文章

如果您对它的工作原理感兴趣,只需查看代码即可,它是开源的;-)。基本上它使用 iOS 5 中引入的 UIViewController 组合。它管理多个“层”,这些“层”是您提供的 UIViewController 。图层的移动由 UIPanGestureRecognizer 和何时移动哪个图层的一些逻辑触发。由于良好的 iOS 动画支持,它看起来和感觉都非常好。

FRLayeredNavigationController 的 API 与 UINavigationController 非常相似,因此很容易使用:-)。 使用 FRLayeredNavigationController:

来自我的 EuroCopaInfo 项目的示例,该项目 com/weissi/EuroCopaInfo/blob/master/EuroCopaInfo/StadiumsViewController.m" rel="nofollow">StadiumsViewController.m

[self.layeredNavigationController pushViewController:wvc inFrontOf:self maximumWidth:YES animated:YES];

来自 AppDelegate.m

InfoCategoriesViewController *icvc = [[InfoCategoriesViewController alloc] init];
FRLayeredNavigationController *lnc = [[FRLayeredNavigationController alloc] initWithRootViewController:icvc configuration:^(FRLayeredNavigationItem *item) {
    item.nextItemDistance = 49;
}];
self.window.rootViewController = lnc;
[self.window makeKeyAndVisible];

另请观看演示视频/屏幕截图:

Using my project FRLayeredNavigationController on GitHub you can easily develop UIs very similar to the Twitter iPad app. There's also a blog post about it.

If you're interested how it works, just look at the code, it's open sourced ;-). Basically it uses UIViewController composition as introduced in iOS 5. It manages multiple "Layers" which are UIViewControllers you provide. The moving of the layers is triggered by a UIPanGestureRecognizer and some logic when to move which layer. It looks and feels very nice because of the nice iOS animation support.

FRLayeredNavigationController's API is quite similar to UINavigationController, so it's easy to use :-). Samples from my EuroCopaInfo project, which uses FRLayeredNavigationController:

In file StadiumsViewController.m:

[self.layeredNavigationController pushViewController:wvc inFrontOf:self maximumWidth:YES animated:YES];

From AppDelegate.m:

InfoCategoriesViewController *icvc = [[InfoCategoriesViewController alloc] init];
FRLayeredNavigationController *lnc = [[FRLayeredNavigationController alloc] initWithRootViewController:icvc configuration:^(FRLayeredNavigationItem *item) {
    item.nextItemDistance = 49;
}];
self.window.rootViewController = lnc;
[self.window makeKeyAndVisible];

Also watch the demo videos/screenshots:

完美的未来在梦里 2024-10-02 11:49:53

这是为 ipad 应用程序获取类似 Twitter 的 UI 的好例子。

查看此链接,它真的很棒!!!!

它提供:

  • 级联视图
  • 方向支持
  • 弹跳效果

Here is the good example of getting twitter-like UI for ipad app.

Check this link, its really awesome!!!!!

It provides :

  • cascade views
  • orientation support
  • bouncing effect
闻呓 2024-10-02 11:49:53

我的猜测:这是一个用于水平移动的 UIScrollView,主视图后面的 UIView 是手动动画的,具体取决于主视图的位置。 UIScrollViewDelegate 提供了许多为背景 UIView 设置动画所需的方法。

My guess: It's a UIScrollView for the horizontal movement, with the UIViews behind the main view being animated by hand, depending on where the main view is. The UIScrollViewDelegate provides a lot of the methods necessary to animate the background UIViews.

调妓 2024-10-02 11:49:53

据称,开发人员将导航控制器扁平化为可滑动面板。但据我所知,尚无其他信息。

原始推文

这有点道理,它基本上只是一个 UINavigationController 和您在堆栈中上下移动的方式会发生变化。现在可以显示多个,而不是一次仅显示 1 个 UIViewController。不过,我无法真正帮助具体实施。

Supposedly the developer flattened a navigation controller into slidable panels. Yet no other info is known to my knowledge.

Original tweet

It kind of makes sense, it's basically just a UINavigationController and the way you move up and down the stack changes. Instead of showing just 1 UIViewController at a time, now multiple can be shown. I can't really help with the exact implementation though.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文