iOS 5:Twitter 编辑器视图显示缓慢

发布于 01-01 17:29 字数 1080 浏览 5 评论 0原文

我有一个关于在 iOS 5 中将 TWTweetComposerViewController 呈现为模态视图的问题。

我使用如下所示的苹果示例代码在我的应用程序中实现 tweet 方法。

-(void)tweet
{
    //Using tweeting example code.

    //Setup the build-in twitter composer view controller
    TWTweetComposeViewController *tweetViewController = [[TWTweetComposeViewController alloc]init];

    //Add url
    [tweetViewController addURL:[self URL]];
    [tweetViewController setInitialText:@""];

    //Present Composer
    [self presentModalViewController:tweetViewController animated:YES];

    //Creat the completion handler
    [tweetViewController setCompletionHandler:^(TWTweetComposeViewControllerResult result)
    {
         //Do something here.

         [self dismissModalViewControllerAnimated:YES];
     }];
    [tweetViewController release];
}

这工作得很好,当我调用 tweet 方法时,tweet 控制器确实显示为模式视图。

但问题是:作曲家出现得很慢。通常需要3-5秒来展示作曲家。当然,这是应用程序第一次调用此方法时。第一次之后,显示速度会快一点,但仍然需要大约 1~2 秒。

我想知道是否有什么地方我做得不对,导致作曲家视图显示缓慢?有什么办法可以加快这个过程吗?

顺便提一句。测试设备是iPhone 4。

谢谢!

I have a question about presenting the TWTweetComposerViewController as a modal view in iOS 5.

I use the apple sample code as below to implement a tweet method in my app.

-(void)tweet
{
    //Using tweeting example code.

    //Setup the build-in twitter composer view controller
    TWTweetComposeViewController *tweetViewController = [[TWTweetComposeViewController alloc]init];

    //Add url
    [tweetViewController addURL:[self URL]];
    [tweetViewController setInitialText:@""];

    //Present Composer
    [self presentModalViewController:tweetViewController animated:YES];

    //Creat the completion handler
    [tweetViewController setCompletionHandler:^(TWTweetComposeViewControllerResult result)
    {
         //Do something here.

         [self dismissModalViewControllerAnimated:YES];
     }];
    [tweetViewController release];
}

This works fine, when I call the tweet method, the tweet controller does appear as a modal view.

However, the problem is: the composer shows up very slowly. It usually takes 3-5 seconds to show the composer. Of course, this is when the app calls this method for the first time. After the first time, it shows up a little bit quicker, but still take about 1~2 seconds.

I wonder if is there something I didn't do right to make the composer view appear slowly? Is there any way to speed up the process?

Btw. the testing device is the iPhone 4.

Thanks!

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

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

发布评论

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

评论(1

陈甜2025-01-08 17:29:59

是的,有。您可以在需要之前在后台初始化该类,从而预加载该类。将 tweetViewController 移动到实例或静态变量中,初始化并设置其所有属性。然后在tweet方法中显示即可。

Yes, there is. You can preload the class by initializing it in the background sometime before you'll ever need it. Move tweetViewController into an instance or static variable, initialize and set all of its properties. Then just show it in the tweet method.

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