修改系統(tǒng)照相機的默認字

今天調用系統(tǒng)的照相和本地相冊,編輯圖片的功能,但是按鈕都是英文,我想改為中文的? 取消,選擇,重拍

需要改變兩種方法

1. UIImagePickerController頁面的Cancel和Choose按鈕以及截取中得重拍按鈕,想改成中文

本來打算通過獲取這些按鈕的指針進行設置的,最后發(fā)現(xiàn)可以在工程中直接 project-->info-->Localization--->language中add一個簡體中文就可以了

參考:http://www.cocoachina.com/bbs/read.php?tid=132828

2.定制當然也有方法

首先通過遞歸的方法不斷地在self.view的hierarchy中不斷遍歷,直到查找到這個view,獲取其指針進行操作

-(UIView*)findView:(UIView*)aView withName:(NSString*)name{? Class cl = [aView class];? NSString*desc= [cl description];if([name isEqualToString:desc])returnaView;for(UIView*viewin aView.subviews) {? ? Class cll = [view class];? ? NSString*stringl= [cll description];if([stringl isEqualToString:name]) {returnview;? ? }? }returnnil;} -(void)addSomeElements:(UIViewController*)viewController{? UIView*PLCameraView= [self findView:viewController.view withName:@"PLCameraView"];? UIView*PLCropOverlay= [self findView:PLCameraView withName:@"PLCropOverlay"];? UIView*bottomBar= [self findView:PLCropOverlay withName:@"PLCropOverlayBottomBar"];? UIImageView*bottomBarImageForSave= [bottomBar.subviews objectAtIndex:0];? UIButton*retakeButton=[bottomBarImageForSave.subviews objectAtIndex:0];? [retakeButton setTitle:@"重拍"forState:UIControlStateNormal];? UIButton*useButton=[bottomBarImageForSave.subviews objectAtIndex:1];? [useButton setTitle:@"保存" forState:UIControlStateNormal];? UIImageView*bottomBarImageForCamera= [bottomBar.subviews objectAtIndex:1];? UIButton*cancelButton=[bottomBarImageForCamera.subviews objectAtIndex:1];? [cancelButton setTitle:@"取消"forState:UIControlStateNormal];} - (void)navigationController:(UINavigationController*)navigationController willShowViewController:(UIViewController*)viewController animated:(BOOL)animated{? [self addSomeElements:viewController];}

最后編輯于
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

友情鏈接更多精彩內容