我試圖在我的文本框的佔位符斜體,由於我的應用程序的目標是iOS 6.0或以上更新,決定用attributedPlaceholder
屬性,而不是滾動的東西更多的自定義的。代碼如下:的UITextField attributedPlaceholder沒有效果
NSString *plString = @"optional";
NSAttributedString *placeholder = [[NSAttributedString alloc] initWithString:plString
attributes:@{NSFontAttributeName : [UIFont fontWithName:@"HelveticaNeue-LightItalic" size:15]}];
for (UITextField *t in myTextfields){
t.placeholder = plString;
t.attributedPlaceholder = placeholder;
}
然而,佔位符的樣式仍然不是斜體,而是與普通文本相同,只是較暗而已。我錯過了什麼使NSAttributedString
工作?
我可以重現你的問題,我想這是iOS中的一個錯誤。 – Florian 2013-02-22 19:50:45