目前我正在开发一个多语言应用程序,我想更改Cancel
的{{1}},Use
和Retake
按钮标题。我怎么能这样做?
答案 0 :(得分: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];
答案 1 :(得分:3)
只需在项目中添加所需的本地化:
1)选择项目文件;
2)在“项目和目标”列表中选择项目;
3)选择“信息”(在屏幕的顶部);
4)在“本地化”部分添加所需的语言。
答案 2 :(得分:1)
它会自动更改为设备语言。
你不需要担心这个。你也无法改变它的行为。
控件如:MFMessageComposer
,MFMailComposer
,UIImagePicker
等。会自动将其默认控件文本更改为设备语言。
答案 3 :(得分: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;
}
答案 4 :(得分:0)
这是一堆垃圾。这里只有好的解决方案......
Scope
答案 5 :(得分:-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];
}
}
}
}