滚动 RSS 阅读器 iPhone 视图

发布于 2024-09-12 14:47:41 字数 313 浏览 2 评论 0原文

我计划在当前应用程序的底部添加一个小子视图,以便它可以一次显示一个 RSS 提要标题。为此使用的最佳视图类型是什么? UITextViewUIWebView?也许是自定义 UITableViewCell?如果我使用 UITextView 并点击它,它会显示键盘,但如果我 setUserInteractionEnabledNO 那么我将无法启动不同的查看文章...

滚动每个文本块将使用核心动画来完成,对吧?

谢谢。

I'm planning on adding a small subview to the bottom of my current app so that it can display RSS feed headlines one at a time. What would be the best type of view to use for this? UITextView, UIWebView? Perhaps a custom UITableViewCell? If i use a UITextView and tap it, it displays the keyboard, but if i setUserInteractionEnabled to NO then i wont be able to launch a different view with the article...

Scrolling each block of text would be done using core animation right?

Thanks.

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

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

发布评论

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

评论(1

脸赞 2024-09-19 14:47:41

使用 UILabel。是的,您将使用 Core Animation 来制作动画。这是一个基本的 UIView 动画块,它将 UILabel 从屏幕的最右侧移动到左侧。

// Set your label to display offscreen to the right
[feedLabel setCenter:CGPointMake(
                   screenWidth + [feedLabel bounds].size.width / 2, 
                   [feedLabel frame].origin.y)];

// Then later animate it into view and then off to the left.
[UIView beginAnimations:nil context:NULL];
// Give it 10 seconds to make it all the way across.
[UIView setAnimationDuration:10.0f];
[feedLabel setCenter:CGPointMake(
                   0.0 - [feedLabel bounds].size.width / 2, 
                   [feedLabel frame].origin.y)];
[UIView commitAnimations];

请记住,诸如 UILabel 之类的视图的 anchorPoint 是视图的中心。这就是为什么调用 -setCenter 使用标签宽度的一半来确定 x 坐标的位置。当然,y 坐标应该保持不变。

Use a UILabel. And yes, you will use Core Animation to animate. Here is a basic UIView animation block that will move a UILabel from the far right of the screen to the left.

// Set your label to display offscreen to the right
[feedLabel setCenter:CGPointMake(
                   screenWidth + [feedLabel bounds].size.width / 2, 
                   [feedLabel frame].origin.y)];

// Then later animate it into view and then off to the left.
[UIView beginAnimations:nil context:NULL];
// Give it 10 seconds to make it all the way across.
[UIView setAnimationDuration:10.0f];
[feedLabel setCenter:CGPointMake(
                   0.0 - [feedLabel bounds].size.width / 2, 
                   [feedLabel frame].origin.y)];
[UIView commitAnimations];

Remember that the anchorPoint for a view such as a UILabel is the center of the view. This is why the call to -setCenter is taking half the width of the label to determine where the x coordinate should be. The y coordinate, of course, should just stay the same.

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