Ios SLComposeViewController缓慢出现
Ios SLComposeViewController缓慢出现,ios,objective-c,slcomposeviewcontroller,Ios,Objective C,Slcomposeviewcontroller,SLComposeViewController显示后需要3-4秒。但是presentViewController:(UIViewController*)动画:(BOOL)completion:^(void)completionmethods完成块立即被调用。因此,即使我使用加载指示器,它也会在眨眼间消失。相关代码如下。顺便说一句,我尝试了dispatch\u async但没有成功 我怎样才能加快进程你有什么想法吗 SLComposeViewController *shareView = [SLC
SLComposeViewController
显示后需要3-4秒。但是presentViewController:(UIViewController*)动画:(BOOL)completion:^(void)completion
methods完成块立即被调用。因此,即使我使用加载指示器,它也会在眨眼间消失。相关代码如下。顺便说一句,我尝试了dispatch\u async
但没有成功
我怎样才能加快进程你有什么想法吗
SLComposeViewController *shareView = [SLComposeViewController composeViewControllerForServiceType: SLServiceTypeFacebook];
[shareView setTitle:@"Title"];
[shareView setInitialText:@"Description"];
[shareView addURL:[NSURL URLWithString:@"http://www.google.com/"]];
[shareView setCompletionHandler:^(SLComposeViewControllerResult result) {
switch (result) {
case SLComposeViewControllerResultCancelled:
{
NSLog(@"Facebook Post Canceled");
break;
}
case SLComposeViewControllerResultDone:
{
NSLog(@"Facebook Post Successful");
break;
}
default:
break;
}
}];
UIActivityIndicatorView *activityView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
activityView.center = CGPointMake([UIScreen mainScreen].bounds.size.width / 2.0, [UIScreen mainScreen].bounds.size.height / 2.0);
[activityView startAnimating];
[self.view addSubview:activityView];
[self presentViewController:shareView animated:YES completion:^{
NSLog(@"Presented facebook");
[activityView removeFromSuperview];
}];
所以,这不是一个解决方案,但它可能会帮助你。我无法让事情更快地显示出来,我认为这只是实现在显示自己之前引入数据 由于presentViewController完成几乎立即执行,因此我的解决方法是显示进度视图,并设置选择器以在2秒后执行。选择器只是隐藏进度视图,下面是一个示例
[MBProgressHUD showHUDAddedTo:self.view animated:YES];
[self performSelector:@selector(hideProgressView) withObject:nil afterDelay:2.0f];
[self presentViewController:self.composeViewController animated:YES completion:nil];
- (void)hideProgressView
{
[MBProgressHUD hideHUDForView:self.view animated:YES];
}
你查过这个了吗?是的,我查过了。我发布了一个新问题,因为我也想问为什么完成块返回,但视图显示速度不如现在快。你找到了有效的解决方案吗?@boilinglame不,我无法让它显示得快。所以我放了一个像Android toast这样的动画文本,说“共享屏幕正在打开”,持续1秒。