的iOS4的本地化的UISearchBar我已經測試我的應用程序3.1.3當設備語言設置爲德語它顯示的UISearchBar
取消按鈕本地化爲德語。在iOS4上顯示爲「取消」。有什麼具體的我需要在iOS4做觸發取消按鈕顯示爲本地化的字符串?取消按鈕
Q
取消按鈕
2
A
回答
4
更改取消按鈕標題:
for (UIView *subview in [searchBar subviews]) {
if ([NSStringFromClass([subview class]) isEqualToString:@"UINavigationButton"]){
// http://github.com/kennytm/iphone-private-frameworks/blob/master/UIKit/UINavigationButton.h
[subview performSelector:@selector(setTitle:) withObject:@"newTitle"];
}
}
您還可以找到取消按鈕尋找與尺寸48,30的元素。使用CGRect bounds = [subview bounds]; CGSize size = bounds.size;
+0
如果您想避免將類名稱作爲字符串進行比較,我正在編寫一個更一般的方法(SDK更新後可能會更健壯)。偉大的職位,得不償失了票:) 爲(UIView的*在[搜索欄子視圖]子視圖) { 如果([子視圖類] isSubclassOfClass:[UIButton的類]) [子視圖performSelector:@選擇(的setTitle: )withObject:[[[[LocaleManager sharedLocaleManager] languageDictionary] valueForKey:@「General」] valueForKey:@「cancelButtonTitle」]]; } – banDedo 2011-10-19 00:39:02
相關問題
- 1. JDialog取消按鈕
- 2. jqTransform取消按鈕
- 3. WKInterfaceController取消按鈕
- 4. WPF取消按鈕
- 5. iPhone取消按鈕
- 6. 如何「取消」按鈕按?
- 7. UISearchController關閉取消按鈕後取消按鈕
- 8. Ios:取消高亮取消按鈕
- 9. Javascript提示取消按鈕不「取消」
- 10. Android:DatePickerdialog與取消按鈕
- 11. 取消showinputdialogbox中的按鈕
- 12. UISearchBar裏面取消按鈕
- 13. UISearchcontroller取消按鈕代理
- 14. jeditable取消按鈕回調?
- 15. UISearchbar上的取消按鈕
- 16. 提交按鈕取消
- 17. 取消單選按鈕wpf
- 18. jQuery:slideUp.delay.slideDown - 用按鈕取消?
- 19. Laravel表單按鈕取消
- 20. FBDialog取消按鈕回調
- 21. UIAlertView無取消按鈕?
- 22. IAP iOS UIAlertView取消按鈕
- 23. 取消按鈕HTML jQuery
- 24. 取消按鈕使用MBProgressView
- 25. Bootstrap Validator.js和取消按鈕
- 26. 取消選項組按鈕
- 27. showBluetoothAccessoryPickerWithNameFilter:完成:取消按鈕
- 28. Powershell&取消按鈕或ESC
- 29. UISearchBar取消按鈕Xcode 4.3?
- 30. SWT覆蓋取消按鈕
在info.plist中設置「本地化本土發展區」爲德國解決這個問題。 – alisdairmills 2010-10-29 10:38:39
保重,它似乎不能在模擬器中工作。在設備上進行測試。 – nverinaud 2011-11-17 10:18:51