UIPickerView内容居中显示,设置初始默认值
来源:互联网 发布:数据精灵后台授权 编辑:程序博客网 时间:2024/03/28 22:40
系统默认的是内容居左显示的,有时会觉得不太好看,可以实现代理方法。
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
{
UILabel *label = [[[UILabel alloc] initWithFrame:CGRectMake(12.0f, 0.0f, [pickerView rowSizeForComponent:component].width-12, [pickerView rowSizeForComponent:component].height)] autorelease];
[label setText:[pickerData objectAtIndex:row]];
label.backgroundColor = [UIColor clearColor];
[label setTextAlignment:UITextAlignmentCenter];
return label;
}
设置初始默认值
[pickerView selectRow:3 inComponent:0 animated:NO];
转自:http://blog.csdn.net/xiaoxiangzhu660810/article/details/9271239
0 0
- UIPickerView内容居中显示,设置初始默认值
- UIPickerView内容居中显示,设置初始默认值
- UIPickerView内容居中显示,设置初始默认值
- c# 设置窗体初始化为居中显示
- 设置input 内容居中显示
- 设置input 内容居中显示
- 让UIPickerView居中循环显示数据
- UITextField通过UIPickerView显示选择内容
- C#设置DataGridView某一具体单元格的内容居中显示
- div内容居中显示
- JTable内容居中显示
- ExtJS内容居中设置
- 设置窗口居中显示
- sqlserver建表时设置字段初始默认值的示例
- 安卓 sinner 联动设置setOnItemSelectedListener初始默认值 实例
- JTalbe中内容居中显示
- 使组件内容居中显示
- 自定义AlertDialog内容居中显示
- matlab中的符号对象与符号运算
- HDU 1087 lcs变形 (简单DP)
- AndroidStudio中使用.9图片
- unity3d 消息传递系统Messaging System
- 学习C++(2)之类的静态成员及静态成员函数
- UIPickerView内容居中显示,设置初始默认值
- 如何一次退出多个Activity
- 获取当前系统时间作为文件名
- 两个链表的交叉——值得注意的错误
- Heritrix3.3.0源码阅读 允许重复下载
- Redis源码分析二、Redis简单动态字符串
- sqlite3.OperationalError: unable to open database file
- 使用FMS 4.5(Flash Media Server 4.5) 搭建视频直播(HLS)
- 各类demo链接