我正在使用iOS 10并使用相机拍照的应用程序。当摄像机 View 打开时,标题为“API_CANCEL_TITLE”,而不是“取消”按钮。当我捕获图片时,整个标题都可以看到,我希望它看起来不是“长”,而不是这个长标题。我已经使用了应用程序本地化。我搜索了几个链接,但找不到解决方案。

这是屏幕截图:

iOS 10相机 View 显示API_Cancel_Title而不是“取消”-LMLPHP

仅在iOS 10中会发生这种情况,在iOS 9中它将正常运行
这是代码:

- (IBAction)takePicturePressed:(UIButton *)sender
{

    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    picker.allowsEditing = YES;
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    [self presentViewController:picker animated:YES completion:nil];
}

请建议...

最佳答案

我已经使用BundleLocalization处理了相同的问题
并且我跟踪了UIImagePickerController key ,它是从捆绑包中获取的。

事实证明,它使用4个“表”(在NSBundle命名法中):

  • CameraUI(用于相机)
  • PhotoLibraryServices(用于PhotoLibrary)
  • PhotoLibrary(用于PhotoLibrary)
  • PhotosUI(用于PhotoLibrary)

  • 就我而言,要做的就是本地化UIImagePickerController接口(interface),它是在项目中创建了几个.strings文件并将其本地化。

    在上面提到的带有键的文件的内容下面(我看到的是标准的英语值),它们很容易解释

    CameraUI.strings
    "PHOTO" = "PHOTO";
    "AEAF_LOCK_TEXT" = "AE/AF LOCK";
    "API_CANCEL_TITLE" = "Cancel";
    "HDR_AUTO" = "Auto";
    "HDR_ON" = "On";
    "HDR_OFF" = "Off";
    "TIMER_OFF_TEXT" = "Off";
    "USE_PHOTO" = "Use Photo";
    

    PhotoLibraryServices.strings
    "PHOTOS" = "Photos";
    "CAMERA_ROLL" = "Camera roll";
    "ALL_SCREENSHOTS" = "Screenshots";
    

    PhotoLibrary.strings
    "CANCEL" = "Cancel";
    "RETAKE" = "Retake";
    "STREAM_SHARED_BY_ME_SUBTITLE" = "From You";
    "STREAM_SHARED_BY_SUBTITLE" = "From %@";
    "ALBUM_IMAGE_COUNT_FORMAT" = "%@ Photos";
    "ALBUM_VIDEO_COUNT_FORMAT" = "%@ Videos";
    "1_ALBUM_PHOTO" = "1 Photo";
    "1_ALBUM_VIDEO" = "1 Video";
    "ALBUM_TWO_TYPES_LABEL_COMMAS" = "%@, %@";
    

    PhotosUI.strings
    "ALL_PHOTOS_IN_LIBRARY" = "Moments";
    "PXUserCollectionsSectionTitle" = "My Albums";
    "FULL_PHOTOS_GRID_ZOOM_LEVEL_TITLE" = "Moments";
    "NO_PHOTOS_OR_VIDEOS" = "No Photos or Videos";
    "EMPTY_ALBUM_LIST_MESSAGE_iPhone" = "You can take photos and videos using camera, or sync photos and videos onto your iPhone using iTunes";
    

    关于iOS 10相机 View 显示API_Cancel_Title而不是“取消”,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/40859312/

    10-11 16:20