UIActivityViewController自定义标题

时间:2013-12-21 00:58:21

标签: ios uiactivityviewcontroller

Custom Title

我想将图标标题和取消按钮文字更改为我的语言可以帮助我 这是示例代码

UIImage *anImage = [UIImage imageNamed:@"SampleImg.png"];
NSArray *Items   = [NSArray arrayWithObjects:
                         @"A text line", 
                         anImage, nil];

UIActivityViewController *ActivityView = 
        [[UIActivityViewController alloc]
               initWithActivityItems:Items applicationActivities:nil];
[self presentViewController:ActivityView animated:YES completion:nil];

1 个答案:

答案 0 :(得分:0)

您无法直接更改Cancel按钮文字,但会自动进行本地化。要更改图标的标题,您必须创建UIActivity的子类并覆盖activityTitle

- (NSString *)activityTitle
{
    // title of your app
    return @"Do stuff";
}

请记住activityTitle should be localised中返回的字符串。