ios - 如何在 iOS Objective C 中更改日期选择器 View 和选择器 View 的字体大小

标签 ios objective-c datepicker uipickerview

我想更改日期选择器和选择器 View 的字体大小。这可能吗 ? 如果是吗?然后是怎么做到的。

最佳答案

没有任何API可以改变UIDatePicker的外观。

您可以使用 UIPickerView 自己制作一个非常令人信服的副本

    - (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView {
return a;}

- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component {
return b;}

- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view {

UILabel *lblpkr= [[UILabel alloc] initWithFrame:CGRectMake(p,q,r,s)];
[lblpkr setBackgroundColor:[UIColor clearColor]];
[lblpkr setTextColor:[UIColor blueColor]];
[lblpkr setFont:[UIFont boldSystemFontOfSize:x]];
[lblpkr setText:[NSString stringWithFormat:@"%d",row]];

return lblpkr;}

对于 swift

请参阅此内容以了解 UIDatePicker 的可自定义实现

https://github.com/prolificinteractive/PIDatePicker

关于ios - 如何在 iOS Objective C 中更改日期选择器 View 和选择器 View 的字体大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37678487/

相关文章:

ios - 旧库,新 CocoaPods

ios - 核心蓝牙 : unable to discover characteristics for discovered peripheral

ios - NSNotification 面向对象

jquery - 在 jquery UI datepicker 范围中使用 altFormat 和 altField

javascript - 我正在将 Bootstrap Timepicker 与 twitter bootstrap 一起使用,但它不会在单击时间图标时显示时间选择器弹出窗口

ios - 解析 CloudCode 以从 PFRelation 中删除用户

ios - 是否可以在 iOS 中以编程方式返回到之前打开的应用程序?

ios - 如何将 C int 放入 NSArray?

jquery - 我可以通过 jQuery 的 html 找到按钮吗?

iphone - iOS 应用内购买