美文网首页
设置PickerView分割线属性&字体属性

设置PickerView分割线属性&字体属性

作者: 213dfddbef5e | 来源:发表于2017-02-28 15:57 被阅读698次
    // 设置PickerView分割线属性&字体属性
    - (UIView *)pickerView:(UIPickerView *)pickerView viewForRow:(NSInteger)row forComponent:(NSInteger)component reusingView:(UIView *)view
    {
        // 设置分割线的颜色
        for(UIView *singleLine in pickerView.subviews)
        {
            if (singleLine.frame.size.height < 1)
            {
                singleLine.backgroundColor = [UIColor colorWithRed:50/255.0 green:50/255.0 blue:50/255.0 alpha:1.0];
            }
        }
        
        // 设置文字的属性
        UILabel *pickerLabel = [[UILabel alloc] init];
        pickerLabel.text = self.hours_Array[row];
        pickerLabel.textAlignment = NSTextAlignmentCenter;
        pickerLabel.textColor = [UIColor whiteColor];
        pickerLabel.font = [UIFont systemFontOfSize:23];
       // pickerLabel.font = [UIFont boldSystemFontOfSize:30];// ------加粗字体
    
        return pickerLabel;
    }
    

    相关文章

      网友评论

          本文标题:设置PickerView分割线属性&字体属性

          本文链接:https://www.haomeiwen.com/subject/odwxgttx.html