IOS 5: Twitter composer view appears slowly

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

I am using the apple example code as shown below to implement the tweet method in my application.

 -(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 great when I call the tweet method, the tweet controller is displayed as a modal view.

However, the problem is that the composer appears very slowly. It usually takes 3-5 seconds to show the composer. Of course, this is when the application calls this method for the first time. After the first time it appears a little faster, but it still takes about 1 ~ 2 seconds.

I wonder if there is something that I didn’t do right to make the composer's performance slow? Is there a way to speed up the process?

Btw. The testing device is the iPhone 4.

Thanks!

+7
source share
1 answer

Yes there is. You can preload the class by first initializing it in the background before you need it. Move tweetViewController to an instance or static variable, initialize and set all your properties. Then just show it in the tweet method.

+4
source

All Articles