iOS 修改textholder的颜色

UITextField *textField = [[UITextField alloc]initWithFrame:CGRectMake(10, 50, 320, 50)];
    textField.placeholder = @"填写订单";
    if ([textField respondsToSelector:@selector(setAttributedPlaceholder:)]) {
        UIColor *color = [UIColor redColor];
        textField.attributedPlaceholder = [[NSAttributedString alloc] initWithString:@"填写订单" attributes:@{NSForegroundColorAttributeName: color}];
    } else {
        NSLog(@"Cannot set placeholder text‘s color, because deployment target is earlier than iOS 6.0");
        // TODO: Add fall-back code to set placeholder color.
    }
    [self.view addSubview:textField];

iOS 修改textholder的颜色,,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。