2

目前我正在开发一个多语言应用程序,我Cancel想更改. 我怎样才能做到这一点?UseRetakeUIImagePickerController

4

6 回答 6

3

只需在您的项目中添加所需的本地化:
1)选择项目文件;
2)在“项目和目标”列表中选择您的项目;
3)选择“信息”(在屏幕顶部);
4) 在“本地化”部分添加所需的语言。

于 2014-09-08T11:15:47.877 回答
3

我的问题是通过使用自定义覆盖类解决的。

self.picker = [[UIImagePickerController alloc] init];
self.picker.sourceType = UIImagePickerControllerSourceTypeCamera;
self.picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
self.picker.cameraDevice = UIImagePickerControllerCameraDeviceRear;
self.picker.showsCameraControls = NO;
self.picker.navigationBarHidden = YES;
self.picker.toolbarHidden = YES;
self.picker.wantsFullScreenLayout = YES;

// Insert the overlay
self.overlay = [[OverlayViewController alloc] initWithNibName:@"Overlay" bundle:nil];
self.overlay.pickerReference = self.picker;
self.picker.cameraOverlayView = self.overlay.view;
self.picker.delegate = self.overlay;

[self presentModalViewController:self.picker animated:NO];
于 2013-05-08T11:47:04.067 回答
1

它将自动更改为设备语言。

你不需要担心这个。你也不能改变它的行为。

控件,如:MFMessageComposerMFMailComposerUIImagePicker。将其默认控件文本自动更改为设备语言。

于 2013-05-08T09:06:54.150 回答
1

将委托作为 self 分配给您的 imagepicker 控制器并添加以下代码:

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated {

     UINavigationItem *ipcNavBarTopItem;

    // add done button to right side of nav bar
    UIBarButtonItem *doneButton = [[UIBarButtonItem alloc] initWithTitle:@\"Done\"
                            style:UIBarButtonItemStylePlain 
                            target:self 
                            action:@selector(saveImages:)];

    UINavigationBar *bar = navigationController.navigationBar;
   [bar setHidden:NO];
       ipcNavBarTopItem = bar.topItem;
       ipcNavBarTopItem.title = @\"Pick Images\";
   ipcNavBarTopItem.rightBarButtonItem = doneButton;
}
于 2013-05-08T09:18:27.007 回答
0

只有好的解决方案在这里......

//this is your camera method
- (void)startCameraControllerUsingDelegate:(id<UIImagePickerControllerDelegate, UINavigationControllerDelegate>)delegate gallery:(BOOL)openGallery
{
    if (([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera] == NO)
        || (delegate == nil))
        return;

    UIImagePickerController *cameraUI = [[UIImagePickerController alloc] init];
    if (openGallery) {
        cameraUI.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    } else {
        cameraUI.sourceType = UIImagePickerControllerSourceTypeCamera;
    }

    cameraUI.allowsEditing = YES;
    //set your delegate type UINavigationControllerDelegate here! It will trigger function bellow!
    cameraUI.delegate = delegate;

    [self presentViewController:cameraUI animated:YES completion:nil];
}

//UINavigationControllerDelegate function
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    //this is where magic happends! This leaves button empty and it will not ruin title center position!... or give it your desired string
    viewController.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];
}
于 2018-02-27T12:07:54.500 回答
-1

只需找到并更改 UIButton 的文本

-(void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
    {
        for (UIView *v in viewController.view.subviews)
        {
            if ([v isKindOfClass:[NSClassFromString(@"CMKBottomBar") class]])
            {
                SEL se = NSSelectorFromString(@"cancelButton");

                if ([v respondsToSelector:se])
                {
                    UIButton *cancelButton =  [v performSelector:se];
                    [cancelButton setTitle:@"New title" forState:UIControlStateNormal];
                }

            }
        }
    }
于 2016-09-07T08:49:58.493 回答