ios中修改自定义PickerView的字体颜色
2016-11-19 16:31
447 查看
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view{
UILabel* pickerLabel = (UILabel*)view;
if (!pickerLabel){
pickerLabel = [[UILabel alloc] init];
// Setup label properties - frame, font, colors etc
//adjustsFontSizeToFitWidth property to YES
[pickerLabel setBackgroundColor:[UIColor clearColor]];
[pickerLabel setFont:[UIFont boldSystemFontOfSize:15]];
}
// Fill the label text here
pickerLabel.text=[self pickerView:pickerView titleForRow:row forComponent:component];
pickerLabel.textAlignment = NSTextAlignmentCenter;
return pickerLabel;
}
UILabel* pickerLabel = (UILabel*)view;
if (!pickerLabel){
pickerLabel = [[UILabel alloc] init];
// Setup label properties - frame, font, colors etc
//adjustsFontSizeToFitWidth property to YES
[pickerLabel setBackgroundColor:[UIColor clearColor]];
[pickerLabel setFont:[UIFont boldSystemFontOfSize:15]];
}
// Fill the label text here
pickerLabel.text=[self pickerView:pickerView titleForRow:row forComponent:component];
pickerLabel.textAlignment = NSTextAlignmentCenter;
return pickerLabel;
}
相关文章推荐
- ios中修改自定义PickerView的字体颜色
- iOS WebView修改字体、大小、颜色
- iOS datepicker 和 pickerView 设置字体颜色
- IOS_设置UITableView Section的背景颜色和字体颜色(自定义section布局)
- iOS中webView的字体大小/颜色 以及背景颜色修改
- iOSwebView修改字体大小字体颜色背景颜色
- IOS修改titleView的字体颜色
- [iOS]修改UITextfield的Placeholder字体的颜色
- 自定义个性cmd界面 轻松打造个性的cmd 修改cmd字体颜色 添加个性cmd内容(转)
- 修改tableview的searchIndex字体颜色。
- 使用selector修改TextView中字体的颜色
- ios iphone 自定义UIPickerView
- 安卓中在TextView中每行的特定位置修改字体颜色以及添加滚动条(纯代码实现)
- 修改TTLauncherView的标题字体颜色
- iOS 修改textField的placeholder的字体颜色
- [IOS]UIPickerView(自定义选择器)
- ios 修改UITabBarItem字体颜色,正常与选中状态
- 设置UITableView Section的背景颜色和字体颜色-自定义Section
- 使用selector修改TextView中字体的颜色
- 自定义Section:修改UITableView的Section的背景和字体