UIActivityViewController 背景颜色

Posted

技术标签:

【中文标题】UIActivityViewController 背景颜色【英文标题】:UIActivityViewController Background Color 【发布时间】:2012-11-25 23:56:53 【问题描述】:

所以我的应用程序中有一个UIActivityViewController。如何更改背景颜色。 我也有一个快速如何将 Facebook 和 twitter 添加到我的UIActivityViewController 的方法。

守则:

    - (IBAction)Social:(id)sender 
            UIActivityViewController *social = [[UIActivityViewController alloc]initWithActivityItems:[NSArray arrayWithObjects:@"Travel+ Rocks",nil] applicationActivities:nil];
            social.excludedActivityTypes = @[UIActivityTypeCopyToPasteboard,UIActivityTypeAssignToContact,UIActivityTypePostToWeibo,UIActivityTypePrint];   
            [self presentViewController:social animated:YES completion:nil];
            [social setCompletionHandler:^(NSString *activityType, BOOL completed)
             
                 NSLog(@"Activity = %@",activityType);
                 NSLog(@"Completed Status = %d",completed);

                 if (completed)
                 
                    // UIAlertView *objalert = [[UIAlertView alloc]initWithTitle:@"Alert" message:@"Your Posts were sucessful" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
                    // [objalert show];
                    // objalert = nil;
                 else
                 
                    // UIAlertView *objalert = [[UIAlertView alloc]initWithTitle:@"Alert" message:@"Your Posts weren't sucessful" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
                    // [objalert show];
                    // objalert = nil;



                 
             ];
        

这些代码修复了后台错误:

NSString *message = [NSString stringWithFormat:@""];
    NSString *textToShare = message;
    UIImage *imageToShare = [UIImage imageNamed:@""];
    NSArray *activityItems = [[NSArray alloc]  initWithObjects:textToShare, imageToShare,nil];
    UIActivity *activity = [[UIActivity alloc] init];
    NSArray *applicationActivities = [[NSArray alloc] initWithObjects:activity, nil];
    UIActivityViewController *activityVC =
    [[UIActivityViewController alloc] initWithActivityItems:activityItems
    applicationActivities:applicationActivities];
    [self presentViewController:activityVC animated:YES completion:nil];

【问题讨论】:

【参考方案1】:

看看下面链接的示例代码你可能会有所了解...

https://github.com/coryalder/DMActivityInstagram/downloads

【讨论】:

【参考方案2】:

如果您设置了目标 -> 摘要 -> 状态栏样式,则共享视图的颜色将跟随。最好的 iv 发现了.....

希望对你有帮助

【讨论】:

以上是关于UIActivityViewController 背景颜色的主要内容,如果未能解决你的问题,请参考以下文章

UIActivityViewController 背景颜色

UIActivityViewController 共享 UIActivity 未显示

UIActivityViewController 不适用于 WKWebView

限制 UIActivityViewController 共享扩展活动

尝试呈现 UIActivityViewController 时崩溃

更改 UIActivityViewController 的 navigationBar 的颜色