2017-10-06 94 views
0

我有一個大問題,我正在開發一個西班牙語的應用程序,所以標籤和控件需要用西班牙語。問題是,當我從相機中選擇一張照片時,默認相機控件帶有英語:「拍照」,「取消」和「重拍」。我的問題是,如果我可以自定義這個按鈕,使其出現在西班牙語中:「托馬爾Foto」,「取消」和「回到托馬爾」。我可以使用自定義攝像頭覆蓋自定義相機控制按鈕的標題嗎?

其實,這是我的代碼:

-(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]; 
     } 
    } 
} 
+1

如果您的應用程序設置爲支持西班牙語本地化,並且用戶已將其設備設置爲使用西班牙語,則標準控件的所有按鈕和標籤也將顯示西班牙語。 – rmaddy

+0

非常感謝您的幫助! –

回答

0

[NSUserDefaults的standardUserDefaults]的setObject:[NSArray的arrayWithObjects:@ 「德」,@ 「恩」,@ 「FR」,零] forKey:@「AppleLanguages 「];

[[NSUserDefaults standardUserDefaults] synchronize]; //立即進行更改