回答編集履歴

3

修正

2016/06/11 01:29

投稿

_Kentarou
_Kentarou

スコア8490

test CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  }else {
16
16
 
17
- attributeText.addAttribute(NSUnderlineStyleAttributeName, value: NSUnderlineStyle.StyleNone.rawValue, range: NSMakeRange(0, mylabel.text?.characters.count ?? 0))
17
+ attributeText.addAttribute(NSUnderlineStyleAttributeName, value: NSUnderlineStyle.StyleNone.rawValue, range: NSMakeRange(0, field.text?.characters.count ?? 0))
18
18
 
19
19
  mylabel.attributedText = attributeText
20
20
 

2

修正

2016/06/11 01:29

投稿

_Kentarou
_Kentarou

スコア8490

test CHANGED
@@ -14,9 +14,9 @@
14
14
 
15
15
  }else {
16
16
 
17
- attributeText.addAttribute(NSUnderlineStyleAttributeName, value: NSUnderlineStyle.StyleSingle.rawValue, range: NSMakeRange(0, 0))
17
+ attributeText.addAttribute(NSUnderlineStyleAttributeName, value: NSUnderlineStyle.StyleNone.rawValue, range: NSMakeRange(0, mylabel.text?.characters.count ?? 0))
18
18
 
19
- mylabel.attributedText = attributeText
19
+ mylabel.attributedText = attributeText
20
20
 
21
21
  }
22
22
 

1

修正

2016/06/11 01:27

投稿

_Kentarou
_Kentarou

スコア8490

test CHANGED
@@ -23,3 +23,15 @@
23
23
  }
24
24
 
25
25
  ```
26
+
27
+
28
+
29
+ あと文字を入力しないで、`Switch`を`ON`にすると落ちるので、`attributeText`を宣言のところで初期化しておくとよいと思います。
30
+
31
+
32
+
33
+ ```swift
34
+
35
+ var attributeText = NSMutableAttributedString()
36
+
37
+ ```