In ios, the text of the button on the UIImagePickerController page is changed to Chinese.

Source: Internet
Author: User

In ios, the text of the button on the UIImagePickerController page is changed to Chinese.

Today, we call the system's photo taking and local album editing functions, but the buttons are all in English. I want to change them to Chinese to cancel, select, and repeat.

Two methods need to be changed

1. On the UIImagePickerController page, change the Cancel and Choose buttons as well as the repeat button in the screenshot to Chinese.

I was going to set it by getting the pointer of these buttons, and finally found that you can directly add a simplified Chinese character to the project --> info --> Localization ---> language in the project.

Reference: http://www.cocoachina.com/bbs/read.php? Tid = 132828

2. There are methods for customization.

First, recursively traverse the hierarchy of the self. view until the view is found and Its pointer is obtained for operation.

-(UIView *) findView :( UIView *) aView withName :( NSString *) name {Class cl = [aView class]; NSString * desc = [cl description]; if ([name isEqualToString: desc]) return aView; for (UIView * view in aView. subviews) {Class cll = [view class]; NSString * stringl = [cll description]; if ([stringl isw.tostring: name]) {return view ;}} return nil ;} -(void) addSomeElements :( UIViewController *) viewController {UIView * PLCameraView = [self findView: viewController. view withName: @ "blank"]; 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: @ "replaying" forState: UIControlStateNormal]; UIButton * useButton = [bottomBarImageForSave. subviews objectAtIndex: 1]; [useButton setTitle: @ "save" forState: UIControlStateNormal]; UIImageView * bottomBarImageForCamera = [bottomBar. subviews objectAtIndex: 1]; UIButton * cancelButton = [bottomBarImageForCamera. subviews objectAtIndex: 1]; [cancelButton setTitle: @ "cancel" forState: canceled];}-(void) navigationController :( UINavigationController *) navigationController willShowViewController :( UIViewController *) viewController animated :( BOOL) animated {[self addSomeElements: viewController];}





Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.