ios_Item总结

一、UINavigationItem
1> 获得方式
self.navigationItem // self是指控制器

2> 作用
可以用来设置当前控制器顶部导航栏的内容
// 设置导航栏中间的内容
self.navigationItem.title
self.navigationItem.titleView

二、UIBarButtonItem
1> 用在什么地方
// 设置导航栏左上角的内容
self.navigationItem.leftBarButtonItem
// 设置导航栏右上角的内容
self.navigationItem.rightBarButtonItem

2> 作用
相当于一个按钮

三、UITabBarItem
1> 获得方式
self.tabBarItem // self是指控制器

2> 作用
可以用来设置当前控制器对应的选项卡标签的内容
// 标签的标题
self.tabBarItem.title
// 标签的图标
self.tabBarItem.image
// 标签的选中图标
self.tabBarItem.selectdImage

四、UINavigationBar
1. 导航控制器顶部的栏(UI控件)
2. UINavigationBar上面显示什么内容, 取决于当前控制器的navigationItem属性
3. UINavigationBarviewnavigationItemmodel
4. 由navigationItemUINavigationBar提供显示的数据

五、UITabBar
1. UITabBarController底部的选项卡条

六、UITabBarButton
1. UITabBar底部的每一个标签
2. 每一个UITabBarButton里面显示什么内容,取决于当前控制器的tabBarItem属性
3. UITabBarButtonviewtabBarItemmodel
4. 由tabBarItemUITabBarButton提供显示的数据
merge_root_path = os.path.join(Config.CURRENT_WORKSPACE_ROOT_PATH, Config.CURRENT_WORKSPACE_MERGE_NAME) translation_excel_folder_path = os.path.join(merge_root_path, 'Translation_Excel') if not os.path.exists(translation_excel_folder_path): print('目标翻译文件 {0} 路径不存在'.format(translation_excel_folder_path)) exit(1) merge_android_src_path = os.path.join(merge_root_path, 'Android', 'values-old') merge_android_dst_path = os.path.join(merge_root_path, 'Android', 'values-new') merge_ios_src_path = os.path.join(merge_root_path, 'iOS', 'strings-old') merge_ios_dst_path = os.path.join(merge_root_path, 'iOS', 'strings-new') merge_flutter_src_path = os.path.join(merge_root_path, 'Flutter', 'l10n-old') merge_flutter_dst_path = os.path.join(merge_root_path, 'Flutter', 'l10n-new') merge_pc_src_path = os.path.join(merge_root_path, 'PC', 'old') merge_pc_dst_path = os.path.join(merge_root_path, 'PC', 'new') enable_android_merge = os.path.exists(merge_android_src_path) enable_ios_merge = os.path.exists(merge_ios_src_path) enable_flutter_merge = os.path.exists(merge_flutter_src_path) enable_pc_merge = os.path.exists(merge_pc_src_path) if not os.path.exists(merge_android_dst_path): os.makedirs(merge_android_dst_path) if not os.path.exists(merge_ios_dst_path): os.makedirs(merge_ios_dst_path) if not os.path.exists(merge_flutter_dst_path): os.makedirs(merge_flutter_dst_path) if not os.path.exists(merge_pc_dst_path): os.makedirs(merge_pc_dst_path) if enable_android_merge or enable_ios_merge or enable_flutter_merge or enable_pc_merge: refer_excel_file = os.path.join(Config.CURRENT_WORKSPACE_ROOT_PATH, Config.CURRENT_WORKSPACE_COMMON_NAME, 'Refer_Standard.xls') if os.path.exists(refer_excel_file): refer_tuple = TranslateInfoExcelReader.read_excel_content_list(refer_excel_file) else: refer_tuple = [] translation_excel_file_list = os.listdir(translation_excel_folder_path) translation_excel_file_list = [x for x in translation_excel_file_list if x.endswith(".xlsx")] curr_time = time.strftime('%Y-%m-%d-%X', time.localtime(time.time())).replace(":", '') android_log_file_name = os.path.join(Config.CURRENT_WORKSPACE_ROOT_PATH, Config.CURRENT_WORKSPACE_MERGE_NAME, 'Translation_Log', "AndroidLog" + str(curr_time) + ".txt") flutter_log_file_name = os.path.join(Config.CURRENT_WORKSPACE_ROOT_PATH, Config.CURRENT_WORKSPACE_MERGE_NAME, 'Translation_Log', "FlutterLog" + str(curr_time) + ".txt") pc_log_file_name = os.path.join(Config.CURRENT_WORKSPACE_ROOT_PATH, Config.CURRENT_WORKSPACE_MERGE_NAME, 'Translation_Log', "PCLog" + str(curr_time) + ".txt") ios_log_file_name = os.path.join(Config.CURRENT_WORKSPACE_ROOT_PATH, Config.CURRENT_WORKSPACE_MERGE_NAME, 'Translation_Log', "Log-漏翻记录.txt") extract_root_path = os.path.join(Config.WORKSPACE_BASE_PATH ) locale_json_dst_file = os.path.join(os.path.join(extract_root_path), 'all_englist_translate_dict.text') all_english_translate_dict = dict() with open(locale_json_dst_file, 'r', encoding='utf-8') as f: all_english_translate_dict = json.load(f) if os.path.exists(ios_log_file_name): os.remove(ios_log_file_name) for excel in translation_excel_file_list: excel_file = os.path.join(translation_excel_folder_path, excel) print(excel_file) excel_dict = TranslateInfoExcelReader.read_excel_content_dict(excel_file) for item in excel_dict.values(): check_formatter(item.english, item.translate_result) for refer in refer_tuple: if refer.translate_result in excel_dict: english = refer.english platform = refer.platform no = refer.no note = refer.note translate = FormatSpecifierParser.build_format_char(refer.english, refer.translate_result, excel_dict[ refer.translate_result].translate_result) excel_dict[english] = TranslateInfo(english, translate, platform, no, note) locale = excel.replace('.xlsx', '') for item in excel_dict.values(): # print(excel, item.english, item.translate_result) if item.english in all_english_translate_dict: all_english_translate_dict[item.english][locale] = item.translate_result else: tmp_translate_dict = dict() tmp_translate_dict[locale] = item.translate_result all_english_translate_dict[item.english] = tmp_translate_dict if enable_android_merge and locale in Config.ANDROID_LOCALE_DICT: locale_path = 'values-' + Config.ANDROID_LOCALE_DICT[locale] merge_android_src_english_file = os.path.join(merge_android_src_path, 'values', 'strings.xml') merge_android_src_locale_file = os.path.join(merge_android_src_path, locale_path, 'strings.xml') merge_android_dst_locale_path = os.path.join(merge_android_dst_path, locale_path) XmlMerger(excel_dict, merge_android_src_english_file, merge_android_src_locale_file, merge_android_dst_locale_path, android_log_file_name).merge(1) if enable_ios_merge and locale in Config.IOS_LOCALE_DICT: locale_path = Config.IOS_LOCALE_DICT[locale] + '.lproj' merge_ios_src_english_path = os.path.join(merge_ios_src_path, 'en.lproj') merge_ios_dst_english_path = os.path.join(merge_ios_dst_path, 'en.lproj') merge_ios_src_locale_path = os.path.join(merge_ios_src_path, locale_path) merge_ios_dst_locale_path = os.path.join(merge_ios_dst_path, locale_path) StringsMerger(locale, excel_dict, merge_ios_src_english_path, merge_ios_dst_english_path, merge_ios_src_locale_path, merge_ios_dst_locale_path).merge() if enable_flutter_merge and locale in Config.FLUTTER_LOCALE_DICT: locale_path = Config.FLUTTER_LOCALE_DICT[locale] merge_flutter_src_english_file = os.path.join(merge_flutter_src_path, 'intl_en.arb') merge_flutter_src_locale_file = os.path.join(merge_flutter_src_path, 'intl_' + locale_path + '.arb') merge_flutter_dst_locale_path = os.path.join(merge_flutter_dst_path, 'intl_' + locale_path + '.arb') FlutterMerger(excel_dict, merge_flutter_src_english_file, merge_flutter_src_locale_file, merge_flutter_dst_locale_path, flutter_log_file_name).merge(1) if enable_pc_merge and locale in Config.PC_LOCALE_DICT: locale_path = Config.PC_LOCALE_DICT[locale] merge_pc_src_english_file = os.path.join(merge_pc_src_path, 'en.json') merge_pc_src_locale_file = os.path.join(merge_pc_src_path, locale_path + '.json') merge_pc_dst_locale_path = os.path.join(merge_pc_dst_path, locale_path + '.json') FlutterMerger(excel_dict, merge_pc_src_english_file, merge_pc_src_locale_file, merge_pc_dst_locale_path, pc_log_file_name).merge(1) locale_json_dst_file = os.path.join(os.path.join(extract_root_path), 'all_englist_translate_dict_new.text') with open(locale_json_dst_file, 'w', encoding='utf8') as f2: json.dump(all_english_translate_dict, f2, ensure_ascii=False, indent=2) 代码解析
最新发布
06-28
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值