Localize Done button of MPMoviePlayerViewControlle

2020-03-23 06:17发布

I am using a MPMoviePlayerViewController to present videos. Everything works as expected, but if I switch the device's language to e.g. German, the "Done" button is not localized.

I tried to access the button and set it to my own button implementation like so:

MPMoviePlayerViewController *mp = [[MPMoviePlayerViewController alloc] initWithContentURL:url];

NSLog(@"%@", mp.navigationItem.leftBarButtonItem); // always null, but why?

// override button with locale 
mp.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"Zurück"
                                             style:UIBarButtonItemStyleDone 
                                             target:self 
                                             action:@selector(dismissMoviePlayer:)];

[self presentMoviePlayerViewControllerAnimated:mp];

A similar question has been asked before, but never received any answers: objective-c MPMoviePlayerViewController done button language.

Thanks for your help.

2条回答
Deceive 欺骗
2楼-- · 2020-03-23 06:36

You can change the Info.plist in xml (Open as source code) and put your translation. For example:

<key>CFBundleDevelopmentRegion</key>
<string>es</string>

To put it in spanish (Spanish doesn't appear in the list)

查看更多
劳资没心,怎么记你
3楼-- · 2020-03-23 06:48

check the CFBundleDevelopmentRegion in your Info.plist

查看更多
登录 后发表回答