【问题标题】:Can I customize the title of the buttons at the Camera Controls with Custom Camera Overlay?我可以使用自定义相机叠加自定义相机控件上的按钮标题吗?
【发布时间】:2017-10-06 18:21:43
【问题描述】:

我有一个大问题,我正在开发一个西班牙语的应用程序,因此所有标签和控件都需要使用西班牙语。问题是当我从相机中挑选照片时,默认相机控件以英文显示:“拍照”、“取消”和“重拍”。我的问题是我是否可以自定义此按钮以使其以西班牙语显示:“Tomar Foto”、“Cancelar”和“Volver a tomar”。

这实际上是我的代码:

-(IBAction)takePhoto :(id)sender
{
    if (fotos.count <= 3) {
        UIImagePickerController *imagePickerController = [[UIImagePickerController alloc] init];

        if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
        {
            [imagePickerController setSourceType:UIImagePickerControllerSourceTypeCamera];
        }
        imagePickerController.showsCameraControls = YES;

        // image picker needs a delegate,
        [imagePickerController setDelegate:(id)self];

        // Place image picker on the screen
        if([[[UIDevice currentDevice] systemVersion] floatValue]>=8.0)
        {
            [[NSOperationQueue mainQueue] addOperationWithBlock:^{

                [self presentViewController:imagePickerController animated:NO completion:nil];
            }];
        }
        else
        {
            [self presentViewController:imagePickerController animated:NO completion:nil];
        }
    }
}

【问题讨论】:

  • 如果您的应用设置为支持西班牙语本地化并且用户已将其设备设置为使用西班牙语,则标准控件的所有按钮和标签也将显示西班牙语。
  • 非常感谢您的帮助!

标签: ios objective-c camera uipickerviewcontroller


【解决方案1】:

[[NSUserDefaults standardUserDefaults] setObject:[NSArray arrayWithObjects:@"de", @"en", @"fr", nil] forKey:@"AppleLanguages"];

[[NSUserDefaults standardUserDefaults] 同步]; //立即进行更改

【讨论】:

    猜你喜欢
    • 2011-07-23
    • 2019-01-06
    • 1970-01-01
    • 1970-01-01
    • 2013-05-25
    • 2012-02-17
    • 2010-10-08
    • 2023-03-11
    • 1970-01-01
    相关资源
    最近更新 更多