UIPickerView 隐藏黑线或者修改黑线的颜色
作者:
Z了个L | 来源:发表于
2016-07-28 15:40 被阅读58次// 每行显示什么内容
- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component {
// 返回每一列的每一行展示的数据
return self.mYuList[row];
}
// 每行显示什么内容
- (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
{
// UIPickerView隐藏黑线
// [[pickerView.subviews objectAtIndex:1] setHidden:TRUE];
// [[pickerView.subviews objectAtIndex:2] setHidden:TRUE];
((UIView *)[pickerView.subviews objectAtIndex:1]).backgroundColor = HexColor(0x80593E);
((UIView *)[pickerView.subviews objectAtIndex:2]).backgroundColor = HexColor(0x80593E);
UILabel *myView = nil;
myView = [[UILabel alloc] initWithFrame:CGRectMake(0.0, 0.0, 100, 40)];
myView.textAlignment = NSTextAlignmentCenter;
myView.text = self.mYuList[row];
myView.textColor = HexColor(0x80593E);
myView.font = [UIFont systemFontOfSize:24]; // 用label来设置字体大小
myView.backgroundColor = [UIColor clearColor];
return myView;
}
本文标题:UIPickerView 隐藏黑线或者修改黑线的颜色
本文链接:https://www.haomeiwen.com/subject/lepajttx.html
网友评论