1

在此处输入图像描述所以我的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];
4

2 回答 2

2

查看以下链接的示例代码,您可能会有所了解...

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

于 2012-11-26T04:36:05.820 回答
0

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

在此处输入图像描述

希望能帮助到你

于 2013-01-01T21:10:59.907 回答