使用backgroundColor自定义UIActivityViewController

时间:2014-05-31 16:56:29

标签: ios objective-c uiviewcontroller uiactivityviewcontroller

如何使用UIActivityViewController的所有元素设置底部视图的颜色?

我当前的实现会更改所有视图的颜色 -

CopyLink *copyLink = [[CopyLink alloc]init];
copyLink.delegate = self;

self = [self initWithActivityItems:@[emailActivity] applicationActivities:@[copyLink]];
self.view.backgroundColor = [UIColor redColor];

self.completionHandler = ^(NSString *activityType, BOOL completed)

2 个答案:

答案 0 :(得分:1)

你不能这样做,UIActivityViewController应该采用叠加表的形式,我怀疑你甚至可以访问它的视图,更不用说它的背景颜色了,你可能必须创建一个自定义的子视图,然后使用它作为子视图

答案 1 :(得分:0)

以下是使用UIActivityViewController的最佳方式:

-(void)doStartStopSpinner
{
    if (![spinner isAnimating])
    {
        spinner = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge];
        spinner.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
        spinner.center = self.view.center;
        spinner.backgroundColor = [UIColor colorWithRed:0.0/255.0 green:0.0/255.0 blue:0.0/255.0 alpha:0.6];
        [self.view addSubview:spinner];
        [spinner startAnimating];
    }
    else
    {
        [spinner stopAnimating];
        [spinner removeFromSuperview];
        [viewUpgradePro removeFromSuperview];
    }
}

希望它能提供帮助。