jjzjj

attributedPlaceholder

全部标签

ios - 垂直居中 UITextField 的 attributedPlaceholder

我目前无法在UITextField中垂直对齐attributedPlaceholder,我不知道为什么。这是我正在做的:self.addressBar=[[UITextFieldalloc]initWithFrame:CGRectMake(...)];self.addressBar.backgroundColor=[UIColorwhiteColor];self.addressBar.attributedPlaceholder=[[NSAttributedStringalloc]initWithString:@"Placeholdertext"attributes:@{NSForegr

ios - 垂直居中 UITextField 的 attributedPlaceholder

我目前无法在UITextField中垂直对齐attributedPlaceholder,我不知道为什么。这是我正在做的:self.addressBar=[[UITextFieldalloc]initWithFrame:CGRectMake(...)];self.addressBar.backgroundColor=[UIColorwhiteColor];self.addressBar.attributedPlaceholder=[[NSAttributedStringalloc]initWithString:@"Placeholdertext"attributes:@{NSForegr

ios - UITextField attributedPlaceholder 无效

我正在尝试将我的文本字段中的占位符设为斜体,并且由于我的应用程序针对iOS6.0或更高版本,因此决定使用attributedPlaceholder属性而不是滚动更多自定义内容。代码如下:NSString*plString=@"optional";NSAttributedString*placeholder=[[NSAttributedStringalloc]initWithString:plStringattributes:@{NSFontAttributeName:[UIFontfontWithName:@"HelveticaNeue-LightItalic"size:15]}];f

ios - UITextField attributedPlaceholder 无效

我正在尝试将我的文本字段中的占位符设为斜体,并且由于我的应用程序针对iOS6.0或更高版本,因此决定使用attributedPlaceholder属性而不是滚动更多自定义内容。代码如下:NSString*plString=@"optional";NSAttributedString*placeholder=[[NSAttributedStringalloc]initWithString:plStringattributes:@{NSFontAttributeName:[UIFontfontWithName:@"HelveticaNeue-LightItalic"size:15]}];f

ios - UITextField attributedPlaceholder 颜色和不透明度在 swift 4

我有自定义textField,它有@IBInspectable属性placeHolderColor:UIColor并且工作正常。我通过以下方式设置它:attributedPlaceholder=NSAttributedString(string:placeHolder,attributes:[NSAttributedStringKey.foregroundColor:placeHolderColor])如何以编程方式仅为该属性设置不透明度值,而不是为我的文本字段中的普通文本设置不透明度值?我没有找到任何匹配的NSAttributedStringKey来执行此操作