Dodawanie atrybutu podkreślenia do częściowego tekstu UILabel w storyboard
Jak mogę podkreślić częściowy tekst UILabel
używając tylko storyboardu? Jestem w stanie to zrobić w kodzie i jestem w stanie podkreślić cały tekst etykiety, ale nie tylko jeden lub dwa słowa w ciągu.
35
3 answers
-
Wybierz
UILabel
i przejdź do Sekcji Inspektor atrybutów .
Zmień wartość tekstu z zwykły na przypisany . -
Wybierz konkretną część tekstu, którą chcesz podkreślić .
Uwaga : Jeśli chcesz, aby Pełny tekst był podkreślenie wybierz pełny tekst.
-
Teraz kliknij prawym przyciskiem myszy i zmień czcionkę na podkreślenie .
To podkreśli tekst
130
Author: Rizwan Shaikh,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-06-10 07:52:40
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2015-06-10 07:52:40
Kroki: -
- Przejdź do TextEdit i utwórz tekst UILabel z podkreśleniem.
- Zmień tekst UILabel Na przypisany (przypisany Selektor).
- Skopiuj Podkreślony tekst i przypisz do UILabel.
2
Author: Manish Mahajan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2018-03-29 08:21:33
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2018-03-29 08:21:33
Przez kod:
func underLineText(text: String)-> NSMutableAttributedString
let attributedText = NSMutableAttributedString(string: text)
attributedText.addAttribute(NSMutableAttributedString.Key.underlineStyle, value: NSUnderlineStyle.single.rawValue, range: NSRange(location: 0, length: attributedText.length))
return attributedText
}
//calling of func
yourLbl.attributedText = underLineText(text:yourLbl.text!)
Lista innych rodzajów podkreślenia
NSMutableAttributedString.Key.underlineStyle = NSUnderlineStyle.single.rawValue
NSMutableAttributedString.Key.underlineStyle = NSUnderlineStyle.thick.rawValue
NSMutableAttributedString.Key.underlineStyle = NSUnderlineStyle.double.rawValue
NSMutableAttributedString.Key.underlineStyle = NSUnderlineStyle.patternDot.rawValue
NSMutableAttributedString.Key.underlineStyle = NSUnderlineStyle.patternDash.rawValue
NSMutableAttributedString.Key.underlineStyle = NSUnderlineStyle.patternDashDot.rawValue
NSMutableAttributedString.Key.underlineStyle = NSUnderlineStyle.patternDashDotDot.rawValue
NSMutableAttributedString.Key.underlineStyle = NSUnderlineStyle.byWord.rawValue
0
Author: AyAz,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2020-01-31 15:00:22
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2020-01-31 15:00:22