mg4377娱乐娱城官网_mg4377娱乐手机版_www.mg4377.com

颜色修改

时间:2019-08-09 16:27来源:mg4377娱乐娱城官网
颜色修改。Swift 修改UITextField.Placeholder颜色,修改placeholder颜色 StoreNameEditTextField.attributedPlaceholder = NSAttributedString(string:"点此处输入门店名称",attributes:[NSForegroundColorAttributeName: UIColor.bl

颜色修改。Swift 修改UITextField.Placeholder颜色,修改placeholder颜色

StoreNameEditTextField.attributedPlaceholder = NSAttributedString(string:"点此处输入门店名称",attributes:[NSForegroundColorAttributeName: UIColor.blackColor()])

修改UITextField.Placeholder颜色,修改placeholder颜色 StoreNameEditTextField.attributedPlaceholder = NSAttributedString(string:点这里输入门店名称,attributes:...

StoreNameEditTextField.attributedPlaceholder = NSAttributedString(string:"点此处输入门店名称",attributes:[NSForegroundColorAttributeName: UIColor.blackColor()])

  一种 

第一种

textField.placeholder = @"输入的内容";  
[textField setValue:[UIColor redColor] forKeyPath:@"_placeholderLabel.textColor"]; 

第二种
// 文字属性
NSMutableDictionary *attrs = [NSMutableDictionary dictionary];
attrs[NSForegroundColorAttributeName] = [UIColor redColor];

// NSAttributedString : 带有属性的文字(富文本技术)
NSAttributedString *placeholder = [[NSAttributedString alloc] initWithString:@"手机号" attributes:attrs];
self.phoneField.attributedPlaceholder = placeholder;

编辑:mg4377娱乐娱城官网 本文来源:颜色修改

关键词: Swift 手机开发 iOS开发 代码片段