gpt4 book ai didi

ios - 格式化 UIImagePickerController 的 "Cancel"和 "Choose"按钮的文本

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:21:57 25 4
gpt4 key购买 nike

我想格式化(更改字体类型和大小)UIImagePickerController 中的 CancelChoose 按钮的占位符文本。我检查了几个问题,但找不到可以作为起点的相关答案。已经检查过 Apple 的 PhotoPicker 示例,但它对于这个目的来说太复杂了,我需要一些轻量级的东西来编辑字体。

这是我的图像选择器的代码:

 if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary] == YES) {

UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];

imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;

imagePicker.delegate = self;

imagePicker.allowsEditing = YES;

// this line does nothing
imagePicker.navigationBar.tintColor = [UIColor redColor];

[self presentViewController:imagePicker animated:YES completion:nil];
[self.tableView reloadData];
}

最佳答案

您可以为此使用 UIAppearance 代理:

[[UIBarButtonItem appearanceWhenContainedIn:[UIImagePickerController class], nil] setTitleTextAttributes:@{ NSFontAttributeName : [UIFont fontWithName:@"AmericanTypewriter" size:14.0] } forState:UIControlStateNormal];

UIImagePickerController 中的栏按钮的字体更改为 AmericanTypewriter 大小 14。

关于ios - 格式化 UIImagePickerController 的 "Cancel"和 "Choose"按钮的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24616093/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com